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
280
Sort on a hidden column
posted

I have a Time column that is string formatted in "HH:mm:ss" format.The sort on this is set to descening , some times the sort is not correct as it is a string.

I already have a hidden column that has values in ticks.So when ever the user tries to sort on time column, i thought i would apply the sort order on this

hidden column. How do i acheive this??

I dont want to use the sort comparer as it is taking some cpu.

While going through some other posts i saw that setting the headerclickaction to external will help , but i only want to perform my sorting on

the hidden column only when the user clicks on the Time Column.

Thanks in advance,

Vj

Parents
  • 469350
    Verified Answer
    Offline posted

    Hi Vj,

    You can do this using the SortComparer property on the Column. What you do is create a class that implement IComparer. The IComparer interface is very simple, it only has one method: Compare.

    The Compare method passes you two objects: X and Y. In the case of the grid, these objects will be of type UltraGridCell. So you cast them into UltraGridCells. From there, you can get the Row and from there you can get hidden cells that contain the ticks.

    Then all you have to do is something like this:

    return ticksX.CompareTo(ticksY);

Reply Children