For my app I have a common data source that all users will read from. They will each sort it differently depending on a calculation (in JavaScript) involving both values from the data source and entered by the user. I’m not seeing a way to sort the list by anything other than an existing column in the data source.
I’m trying to avoid using logins since they aren’t necessary for most of what I want to do and I want to avoid any barriers to adoption that I can.
If you already have an LFD component on the screen you do not need to define that. That is an Object that is returned to you by the LFD when the hook runs.
If you would like to use this hook to sort an LFD then you need to do something like this:
Fliplet.Hooks.on('flListDataBeforeRenderList', function(options){
options.records = options.records.sort(function(a, b) {
//This sorts by the column Email in the ascending order.
return order.indexOf(a.data.Email) - order.indexOf(b.data.Email);
});
})
You need to change Email above to the column you want to sort by.
Here are some examples on how to sort a JSON array based on custom conditions.