rxDataTable
rxDataTable copied to clipboard
'sort' key should support functions.
This is how it looks now.
'dataField': 'Name',
'sortField': 'Name'
This will use sorting by the data in the data field matching Name
. This is because you can have cells with more than one piece of data in it at a time, and you have to sort by one.
'dataField': ['subject', 'ref_no'],
'sortField': 'subject'
I would like it if there was support for more than just strings, but also functions. This is my use case:
'dataField': 'listOfLists'
// [[1], [1, 0], [0, 1], [1], [0], [], [0, 0], [], [1, 1, 0]]
'sortField': function (listOfListsData) { return listOfListsData.length; }
// returns [0, 0, 1, 1, 1, 2, 2, 2, 3]
And for multi-part data cells:
'dataField': ['name', 'description'],
'sortField': function (name, description) {
return _.contains(name, 'Important') || _.contains(description, 'overdue');
}
Love it. I've actually been thinking of moving most of the key munging stuff to just functions. I think it'll be cleaner and more explicit.