Hi team,
As per business requirement we need sorting in such a way that null or blank values always comes in last on sorted column. Do we have anything on grid level that can help us to achieve this requirement.
Thanks
Hi,
Please see docs https://bryntum.com/products/grid/docs/api/Grid/feature/Sort
you can define any sort method you need and sort as you need.
// custom sorting function can also be specified on the store
const grid = new Grid({
store : {
sorters : [{
fn : (recordA, recordB) => {
// apply custom logic, for example:
return recordA.name.length < recordB.name.length ? -1 : 1;
}
}]
}
});
All the best,
Alex
fn : (recordA, recordB) => {
// apply custom logic, for example:
return recordA.name.length < recordB.name.length ? -1 : 1;
}
So as per this function I will sort all records at the time of data load. But my requirement is when user sort any column by clicking on it. then I need to sort in above way.
As I have a way to do this on each column.
columns : [
{
field : 'age',
text : 'Age',
sortable(lhs, rhs) {
// Custom sorting, see Array#sort
}
}
],
but is there any generic way that will fix for all columns instead of doing on each column??