Can we mix static sorting with dynamic sorting?

Can we mix static sorting with dynamic sorting?

  

I need to have static sorting by default by certain colums but also dynamic one when users click on the table column. Is it possible?

I've tried but seems not working

Hi Eric,

It's possible. In the Sorting of your aggregate you use the function:

List_SortColumn_GetOrderBy(PersonTable.Id, "{Person}.[Name]")

to do dynamic sort. The second parameter of that function is the Attribute (or Attributes) of the Sorting by default.

Cheers,

José

Hi Eric, 

Jose is correct by using above function you can set static sorting by default same time you can define dynamic sorting on certain colums using List_SortColumn event their in RichWidgets by proving column name as string.

I am attaching the sample oml here for your reference.

Sachin

Sorry I was in rush maybe it's not clear.

I have 5 columns lets say colA, colB, colC, colD and colE

First time display I want it sorted by colC, colB, colA

But also I want to let users have dynamic sort by clicking the table column name...so in sorting property of the aggregate I have multiple sorts....

3 sort is static sort (colC, colB, colA)

1 dynamic sort using technique you mentioned above

List_SortColumn_GetOrderBy(PersonTable.Id, "{Person}.[Name]")

But dynamic sort seems not working out.

Hi Eric,

It should work, I also added three static sorting and dynamic as well using the same function 

List_SortColumn_GetOrderBy(EmployeeTable.Id, "{Employee}.[Name] ASC, {Employee}.[Contact] ASC,{Employee}.[Email] ASC")

It's working for me. Please check the sample oml that I am attaching.

Hi Eric,

Imho the main problem here is not a technical one, but a functional one: do you want to support both the manual ordering by column, and the "static" order after the manual order has been set, and if so, what should the user click to achieve this?

Technically, there's also a List_SortColumn_SetOrderBy to set the initial values for the columns, so if you do not need the "static" ordering after a manual ordering, you could use that (and, in case you do need it and have some button or the like, you could use it again for that).

Solution

Thanks for Sachin and Kilian for the answer

Solution

Great to hear we could help you Eric!