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
85
Getting Column Properties from the UltraWebGrid
posted

What i'm looking for is how to get certain column properties back from the grid - in order to save user preferences for Ordering, Grouping and Sorting each time a user loads a particular Grid. I've listed below what i've found that may be useful - but i'm very new to the Infra Grid, and am thinking there are better methods available.

 If it's possible, i'd like to just grab a listing of all Column Titles that are grouped, all that are sorted and the orders of each column. If I can't do that without going through each column in the grid - that's ok but if there's an alternative it would be a lot faster.

Sort;

UltraWebGrid1.Columns.Item(0).SortIndicator.ToString() - this just tells me that the column is descending, or Ascending - is there a better method? I also don't know which Sort should be done first using this method?

Grouping;

UltraWebGrid1.Columns.Item(0).IsGroupByColumn.ToString() - again - I can find out if a Column is grouped - but is there a property that tells me what level of Grouping this column is? I could have two or three columns grouped with no way of knowing where they sit.

Ordering;

Is there a method showing the order of columns besides the Column index? i.e. if a user moves a column three places to the right - I'd like to save that column

 I appreciate any help that is available

 

  • 21382
    posted

     Off the Grid, DisplayLayout, or Band object (I forget which one), is a SortedColumns collection.  This will give you the Sorted Columns and GroupBy columns (since group by is just a sort).  Go through this collection, checking the sort indicator and isgroupby for each column.  They are in the collection in the order that they are applied.

     

    As for order, I think the index is the only way of knowing, but I don't have a webgrid infront of me to verify it.