Our blazing fast Grid component built with pure JavaScript


Post by henrique »

In the code below, when I click the checkbox column, the "onToggle", or "onBeforeToggle" or "onToggleAll" event is not triggered.

// grid with CheckColumn
let grid = new Grid({
    appendTo   : document.body,
    // makes grid as high as it needs to be to fit rows
    autoHeight : true,
    data       : DataGenerator.generateData(5),
    columns    : [
        { field : 'name', text : 'Name', flex : 1 },
        { type : 'check', field : 'done', text : 'CheckColumn', showCheckAll: true, flex : 1, align : 'center', 
         onToggle: () => Toast.show('onToggle clicked'), onBeforeToggle: () => Toast.show('onBeforeToggle clicked'), onToggleAll: () => Toast.show('onToggleAll clicked') }
    ]
});

// Text only
new Button({
    appendTo   : document.body,
    text     : 'Text only',
    onClick: () => Toast.show('Button clicked')
});

Post by mats »

'onXXX' functions aren't called by default, add https://bryntum.com/docs/grid/api/Core/mixin/Events#config-callOnFunctions to true on your column and it'll work.


Post by henrique »

Changed, but still not working for me.

// grid with CheckColumn
let grid = new Grid({
    appendTo   : document.body,
    // makes grid as high as it needs to be to fit rows
    autoHeight : true,
    data       : DataGenerator.generateData(5),
    columns    : [
        { field : 'name', text : 'Name', flex : 1 },
        { type : 'check', field : 'done', flex : 1, align : 'center', text : 'CheckColumn', showCheckAll: true, 
          callOnFunctions : true, 
          onToggle: () => Toast.show('onToggle clicked'),
          onBeforeToggle: () => Toast.show('onBeforeToggle clicked'), 
          onToggleAll: () => Toast.show('onToggleAll clicked') }
    ]
});

// Text only
new Button({
    appendTo   : document.body,
    text     : 'Text only',
    onClick: () => Toast.show('Button clicked')
});

Post by mats »

Right, seems that's a minor bug - we'll look into that. Please use the listeners notation instead:

columns    : [
        { field : 'name', text : 'Name', flex : 1 },
        { type : 'check', field : 'done', flex : 1, align : 'center', text : 'CheckColumn', showCheckAll: true, 
          listeners : {
          toggle: () => Toast.show('onToggle clicked'),
          beforeToggle: () => Toast.show('onBeforeToggle clicked'), 
          toggleAll: () => Toast.show('onToggleAll clicked') }
          }
    ]

Post by henrique »

I will wait for the fix. Thanks for the reply!


Post by henrique »


Post by henrique »

Any news about this bug?


Post by tasnim »

Hi,
We'll consider it for 5.2.x patch release.

Good Luck :),
Tasnim

Best of luck,
Tasnim


Post by henrique »

This still not working...


Post by mats »

It works in 5.1.2, which version did you test?


Post Reply