Our blazing fast Grid component built with pure JavaScript


Post by janan »

We are trying to use 'datetimefield' as a widget column. I see the sorting arrow in the column when i set

sortable : true

to the column but I do not get the sorting work. Could you help with it?


Post by mats »

Could you please provide a simple test case so we see what you are trying to do?


Post by janan »

In the example https://www.bryntum.com/examples/grid/columntypes/, made the following changes to the widget

{
            text    : 'Widget',
            field   : 'date',
            width   : 100,
            sortable: true,
            type    : 'widget',
            widgets : [{
                type     : 'datetimefield',
                tooltip  : 'Add',
                icon     : 'b-fa b-fa-plus',
                cls      : 'b-blue b-raised',
                onAction : ({ source : btn }) => {
                    btn.cellInfo.record.age++;
                }
            }]
        },

. I fill in the datefield as follows
Image
When i sort the column now i do not get it sorted.

Attachments
Screenshot 2020-10-28 at 09.46.42.png
Screenshot 2020-10-28 at 09.46.42.png (238.39 KiB) Viewed 752 times

Post by alex.l »

Hi janan,

By default sort feature uses a value inside a cell for sorting. WidgetColumn contains a widget inside, some HTML code. It cannot be sorted by value inside one of your inputs that you placed, by default. You need to provide your own sortable function with the logic you expected.
Please check https://bryntum.com/docs/scheduler/#Grid/column/WidgetColumn#config-sortable

             sortable : function(rec1, rec2) {
                 return rec1.date < rec2.date ? -1 : 1;
             }

All best,
Alex

All the best,
Alex


Post Reply