[INFO REQ] [CheckColumn]Events - beforeToggle/toggle - Fired on grid store load

Our blazing fast Grid component built with pure JavaScript


Post Reply
User avatar
war2
Posts: 2
Joined: Mon Jun 29, 2020 5:40 pm

[INFO REQ] [CheckColumn]Events - beforeToggle/toggle - Fired on grid store load

Post by war2 »

Hello,

I have the using column - Checkcolumn

Code: Select all

 {
                    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


User avatar
sergey.maltsev
Core Developer
Core Developer
Posts: 567
Joined: Mon Dec 24, 2018 9:15 am

Re: [INFO REQ] [CheckColumn]Events - beforeToggle/toggle - Fired on grid store load

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.

Code: Select all

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

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

Code: Select all

    // 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.


User avatar
war2
Posts: 2
Joined: Mon Jun 29, 2020 5:40 pm

Re: [INFO REQ] [CheckColumn]Events - beforeToggle/toggle - Fired on grid store load

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.


User avatar
mats
Core Developer
Core Developer
Posts: 16159
Joined: Sat Dec 19, 2009 11:41 pm
Location: Sweden
Contact:

Re: [INFO REQ] [CheckColumn]Events - beforeToggle/toggle - Fired on grid store load

Post by mats »

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

Tired of debugging javascript errors in web applications? Try our new error logging service RootCause, or read more on the Sencha blog

@bryntum
Facebook
API documentation

Post Reply