Premium support for our pure JavaScript UI components

Post by dsingh7 »

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.


Post by alex.l »


Please see docs
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 < ? -1 : 1;

All the best,

Post by dsingh7 »

fn : (recordA, recordB) => {
                // apply custom logic, for example:
                return < ? -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??

Post by ghulam.ghous »

Hi dsing,

Unfortunately there is no generic way of achieving this. But you can define a common function and apply it to each column sortable.


Post Reply