OK Folks ... lots of power in the infragistics grid, but I need some help on what "should" be an easy problem. I need the REAL index of the row in the list. This index sits independent of any column sort or row pin. There must be a row property that is storing this index location as I can pin a row, its index changes to 0, I then unpin it and it returns to its original location. I have tried different combinations of the following:
Index
ListIndex
VisibleIndex
But NONE of these 3 properties is actually referencing the real row index for display. So where would I find that row property?
Thanks for any feedback you may have!
Hello,
When you unpin a row, UltraGrid finds the position of the unpinned row, in order to placed it on the correct position in the visible rows collection. So if you pin a row, then re-sort or re-filter some column and unpin the row, UltraGrid placed the unpinned row in the correct position.
So if the Index, ListIndex, VisibleIndex properties doesn’t works for you:
Index The index of this row in its parent collection
ListIndex Returns the index corresponding to this row from the IList that the control is bound to. Return value of -1 indicates that a row has been deleted or doesn't exist anymore.
VisibleIndex Returns the index of this row in its parent collection, relative to all other visible rows. Hidden rows are not counted.
You could handle BeforeRowFixedStateChanged event of UltraGrid and to get the index of the row, which fixed property will be changed (use e.Row in this event), in order to get the index of the row before it is pinned. But you should keep in mind that if customer re-sort or re-filter the grid, when a pinned row is unpinned , this row could be placed on a position different of this before it was pinned.
Please let me know if you have any further questions.
Hmmm... I am not being very clear I guess in the row index that I am looking for, so I will explain why each of the index listed and why BeforeRowFixedStateChanged is such a bad idea. First, I will be more clear as to the problem I am solving. I pull 100 items from the database. Users can "pin/unpin", sort, and filter those rows. These actions ARE NOT saved in the database, so the rows must keep their original display order values. Now the users can also reorder the rows to a specific order. Now the new re-ordered list display order IS saved in the database. Clearly the grid has a property (maybe it is not exposed) that is maintaining its original position but it is not one of the index that you have referenced.
Index - this is the index being displayed - useless for what I am needing when it is pinned/sorted/filtered
ListIndex - this is the original order pulled from the database and does not change even when the Row.Move function is called, so again it is useless if the user moves a row up or down.
VisibleIndex - this is the index in the collection - useless for storing in the database when it is pinned/sorted/filtered
BeforeRowFixedStateChanged- big whoop... not helpful except for pinning, and even then, not very helpful since I need to deal with sorted and filtered conditions
In summary... sorry for being so vague before, but now that I "think" I have explained the problem specifically, I am really hoping that the index property I am looking for is exposed for me to reference. If not, then why not? I can only shake my head in disbelief to think I would have to write my own synchronized array to manage what is clearly already managed by the grid.
But since you are a infragistics staffer - I am hoping you have the magic answers :D