Rank: Newbie Groups: Member
Joined: 11/17/2011 Posts: 9
|
Hi,
How select a row using key field, and not by index.
For example: I have a Grid populated and I want select a row by Keyfiled. I haven't the index this row. How I do it? Is There some property for this? In my case, I am using filters to update and reorganize the Grid. I need that, when the Grid was populated again, the selected row before, is selected again. In this case, I haven't index this rows, because the Grid was reorganized.
Thanks for help.
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
You will have to loop through all the items in order to find out which item has the matching key. The Grid associates a key value to each item purely for your convenience. It simply holds that value but does not do anything about it, nor does it guarantee that the keys are unique for each item. In another word, to the Grid the key is just a value associated to the item. So in order to get the index corresponding to the key value, you have to loop through all items in order to find out. Or you could maintain a separate map completely independent to the Grid and use that map instead.
Thanks!
|