Our blazing fast Grid component built with pure JavaScript


Post by war2 »

Hello,

I have the using column - Checkcolumn

 {
                    type:'check',
                    text:'Renew',
                    field:'autoRenew',
                    listeners:{
                        beforeToggle:()=>{console.log('toggle fired');} 
                    }

What i want to do, is before the check is changed fire a Modal to ask with Accept/Cancel button to allow to change it.

But i realized the beforeToggle and toggle event are being fire on the Grid Store load for each record on it.

There is any way to prevent it ? or should go with click event on cell.

Thanks


Post by sergey.maltsev »

Hi, war2!

I've checked our Grid php demo which uses grid.store.load().
Online demo version available here https://www.bryntum.com/examples/grid/php

I've added column with your config to Grid/examples/php/app.js.

        {
            type      : 'check',
            text      : 'Renew',
            field     : 'autoRenew',
            listeners : {
                beforeToggle : () => {
                    console.log('toggle fired');
                }
            }
        },

then added autoRenew data to Grid/examples/php/php/session.php

    // Initialize session's demo data
    $_SESSION["data"] = array (
        array ("id" => 1, "brand" => "Volvo", "model" => "V90", "dt" => date("Y-m-d H:i:s"), "autoRenew" => true),
        array ("id" => 2, "brand" => "Volvo", "model" => "XC60", "dt" => date("Y-m-d H:i:s")),
        array ("id" => 3, "brand" => "BMW", "model" => "M3", "dt" => date("Y-m-d H:i:s"), "autoRenew" => true),
        array ("id" => 4, "brand" => "BMW", "model" => "X5", "dt" => date("Y-m-d H:i:s")),
        array ("id" => 5, "brand" => "Peugeot", "model" => "308", "dt" => date("Y-m-d H:i:s"), "autoRenew" => true)
    );

Then I started this example locally in browser and tried to reload data, save data and manually check/uncheck autoRenew column check.
beforeToggle fires only on mouse click for me but not on store.load().

Please attach example which shows your problem here.
You could use the same php one form distribution zip.


Post by war2 »

Thanks for the reply.

So i must have something wrong in my code...

Our grid is a TreeGrid , and i realized the "beforeToggle and toggle" is being fire on the "Record" that have leaves . Also when I click on the "button" to "show the leaves records" is fired for each "record" child of the parent record....

I'm using Java/GWT .

Thanks.


Post by mats »

Please provide a test case (JS only, no backend)


Post Reply