Maybe changing the DataProvider resets the selectedIndex.

On 6/1/16, 1:38 AM, "mark goldin" <[email protected]> wrote:

>I have an ADG where I am using a local connection to refresh gird's data
>and select previously selected item.
>The pseudo code might loook like this:
>
>private var _selectedIndex:int = 0;
>private var _navigateToPrevSelection:Boolean = false;
>
>private function get SelectedIndex():int
>{
>return _selectedIndex;
>}
>private function set SelectedIndex(value:int):void
>{
>_selectedIndex = value;
>}
>private function get NavigateToPrevSelection():Boolean
>{
>return _navigateToPrevSelection;
>}
>private function set NavigateToPrevSelection(value:Boolean):void
>{
>_navigateToPrevSelection = value;
>}
>// This function is called when the server has returned a coomand that
>grid's data must be refreshed.
>public function localConnectionHandler():void
>{
>     SelectedIndex = grid.seledctedIndex;
>     // an event "ABC" is fired to generate new data for the grid.
>     // set dataProvider is called since grid's data is bound to the ABC's
>execution result
>    // At this point SelectedIndex has the correct value;
>}
>override public function set dataProvider(value:Object):void
>{
>// When dataProvider is set after ABC was executed the SelectedIndex is
>set
>to _selectedIndex's initial value which is zero.
>        if (value)
>        ....
>}
>
>Can someone please explain why private variables get initialized?
>
>Thanks

Reply via email to