I have created recordlist by appending records.
Now I am giving that recordlist variable as source source to TableRecords widget. But at the time of displaying records, I want to sort by default descending order of created date.
How do I achieve this?
Thanks and Regards,
there is a component available in forge Sort Record List , i think this will help you achieve what you want.
Hi Suraj,Please mark ait as solution if it what you want ..This will help other also.
The problem with this solution is that it expects an Object, not a record list. If you have multiple entities in your recordset (i.e., customers and orders), I think it will lose the record definitions if made an object. Is this correct?
Try ToObject(recordlist) and doing this it will not lose any defination.
Under the hood, OutSystems record lists are also Objects (Java or .NET). The SortRecordList extension uses a mechanism called reflection to inspect what's actually inside the generic Object, and thus can sort the list as you specify. There's nothing lost (otherwise the extension would be a bit useless :))!
Agreed with Killan.
Thanks for the tip, PJ. How do you then bind the results of the sort record list to a Table Records object?
Here is what I have:
- Aggregate with the results of 4 joined tables
- Convert this record list to an object
- SortRecordList on the object
SortRecordList sorts the record list in place (as you may notice from the fact it doesn't have an output parameter). This means that after the call to SortRecordList, your original record is sorted. In the case of a TableRecords, rebinding occurs when you Ajax Refresh it (this also means you always need to sort the source list, then Ajax Refresh, instead of sorting the TableRecords.List, since after refreshing the TableRecords, the changes will be lost).