Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Absolute Sorting

    Hi,

    We would like to add absolute sorting options to all ListGrids in our application. So, instead of just showing "Sort Descending" and "Sort Ascending", we'd always show two additional options for "Sort Ascending (Absolute)" and "Sort Descending (Absolute)". And, we'd be able to persist these sort options into a grid's view state as well if one of the options was selected when the view state was saved.

    Is this possible?

    #2
    Are you working with a complete set of data on the client, or are you using paging?
    If you have a complete dataset for the grid, you could use a custom sort normalizer for the field to get an absolute sort. Since you want both simple value sort and absolute value sort, you'd probably want to have a boolean property on the field like "sortAbsolute" and use that to conditionally normalize to absolute values.

    The extra entries in the header context menu to enable sort can be added by customizing getHeaderContextMenuItems(). Probably easiest to do this as a single extra item ("Sort Absolute Values", with a checkmark to indicate the current state).

    The custom "sortAbsolute" flag would not be stored as part of the normal "getViewState" / "setViewState". However it'd be easy enough to have your code simply check for the sortAbsolute flag on the field and store a string to indicate this along with the view state, then have your calling code to restore the view state check for this stored string and use it to set this flag on the field before calling 'setViewState()' with the rest of the stored state.

    Comment

    Working...
    X