Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1105
UltraGrid Row Index
posted

I'm restrained by some abnormal conditions while in need of knowing what a row's index is.  Here's an example scenario:

1. Bind a datatable to the grid that contains 10 rows.  At this point I can programmatically get the 4th visible row in the grid by: Rows.GetRowAtVisibleIndex(3) or GetRowWithListIndex(3) or even Rows[3].

2. Sort the rows by some arbitrary column.  Now I want to programmatically get the 4th visible row.  I can no longer use Rows.GetRowWithListIndex(3) because the rows are sorted.  However Rows.GetRowAtVisibleIndex(3) still works.

3. Programmatically the user is able at run time to hide any number of columns.  The user happens to hide visible row 2.

4. Now I want to get the 4th visible row in the grid.  I still can't use Rows.GetRowWithListIndex(3) for the same reason as before.  But now I also can't use Rows.GetRowAtVisibleIndex(3) because GetRowAtVisibleIndex ignores rows with .hidden == true so GetRowAtVisibleIndex(3) would actually return the 5th physical row in the grid.

I'm aware that the entire point of ListIndex is to be able to link the bound data row to what is displayed.  But in my particular usage, my code is "dumb" to the bound data once it has occurred.  What I really need is a way to get a row at a visible position...even if that row happens to be hidden.  Is there no master list the grid keeps of rows that while still representing the logical order of the rows, doesn't exclude them for being hidden?

Thanks in advance for any help you can give me