Do this --

Before the collection changes -- store the id(not the selectedIndex) of the
selectedItem in a temp variable.
Now once collection changes -- find the index of the temp id stored above,
in the collection (index of the previous selected Item) and make the
datagrid's selectedIndex as the new index you found in previous step, using
the code sent in my earlier reply.

-V

On Wed, Jan 26, 2011 at 4:47 AM, Pavan Bhogala <[email protected]>wrote:

> What if I want to highlight the particular record, my data will be coming
> from backend and the data varies which is binded to the  datagrid
> dataprovider, e.g., if I selected the 25th id on the selectedindex 24 and
> assume there was no 24th Id, now when the collection is refreshed and stored
> with the 24th Id, it highlights the 24th id instead of 25th id.
>
> This is what I did but I don't want to scroll back to the highlighted
> record since I'll be having varied collection and the datagrid scrollbar
> goes up to the highlighted record whenever the user scrolls the datagrid. We
> don't want the scroll bar go back to the highlighted record.
>
> Pavan Bhogala.                           814-431-0669(C)
>
> On Jan 25, 2011, at 4:44 PM, Vikas Madan <[email protected]> wrote:
>
>
> You need to listen for the collection change event and there you can do
> something like this --
>
> var dataGridSelectedIndex:int = dataGrid.selectedIndex; (store it before
> the datagrid refreshes.)
> //                dataGrid.executeBindings();
>                 dataGrid.selectedIndex = dataGridSelectedIndex;
>                 dataGrid.scrollToIndex(dataGridSelectedIndex);
>
> -V
>
> On Tue, Jan 25, 2011 at 5:32 AM, Pavan B < <[email protected]>
> [email protected]> wrote:
>
>> how to highlight the selected row in datagrid when the dataprovider or the
>> collection binded to it changes.
>>
>> --
>> Thanks
>> Pavan
>> 814-431-0669
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Flex India Community" group.
>> To post to this group, send email to <[email protected]>
>> [email protected].
>> To unsubscribe from this group, send email to
>> <flex_india%[email protected]>
>> [email protected].
>> For more options, visit this group at
>> <http://groups.google.com/group/flex_india?hl=en>
>> http://groups.google.com/group/flex_india?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Flex India Community" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/flex_india?hl=en.
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Flex India Community" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<flex_india%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/flex_india?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en.

Reply via email to