I have a requirement to sort few columns in a paging grid in A to Z & Z to A.
Issue :Sorting is working as expected how ever, When we click on a specific column to sort then NULL data record that is showing on top of the list then followed by A to Z records.
Is there any possibility to show A to Z & Z to A first and a the end of the grid just to show record which has null column.
Note: Grid is populated using record(a!recordData)
Discussion posts and replies are publicly visible
Not in the sorting config, but you could use a custom record field to create a artificial sorting column.
Thanx for quick reply Stefen. the actual requirement is for instance, I have a paging grid with columns as First Name, Middle Name, Last Name, Age, Gender, Qualification. by default, in the grid Initial Sort applied on First Name as Ascending true.
When the user navigates to page where, user can see all the records with Initial Sorting.
Requirement here is, if user goes to specific column either LastName or qualification (only these 2 columns), & click on that specific column (LastName or qualification) then either A to Z or Z to A needs to be shown, however record with empty column (LastName or qualification) must be shown end of the grid once I sort either A to Z or Z to A.
If I take a Custom Field like sortOrder
Question: How can we assign the value for sortOrder Column? records which have data for Last Name or Qualification must have value for sortOrder and the columns which has an empty data for Last Name & qualification must be sortOrder as empty.
though we implement the above approach, we can't keep same column name(sortOder) for all the a!gridColumns(sortField) level. SortField must be unique at each grid column level.
Please let me know, what would be your approach to implement.?
First, I would try to challenge that requirement.
My idea, which I did not implement before is as follows. Based on the selected column and the sort order, you dynamically create a sorting config that always puts NULL rows at the end. To make this work, you will need at least one custom record field that e.g. is 0 for a NULL value, and 1 for a normal string. The sortInfo parameter takes a list of sortInfo structures. And it can apply multiple sorts. So the first sort is always that custom field, and the second one is the field the user selected.
This is just my idea, feel free to use it for your own R&D and keep me posted.