Page 1 of 2

[INFO REQ] Double execution event

Posted: Mon Oct 03, 2022 3:17 pm
by henrique

I need some help!

I've registered an event in the row reordering and the drop event runs twice, is there a way to find out who's firing this second event?


Re: [INFO REQ] Double execution event

Posted: Mon Oct 03, 2022 8:09 pm
by marcio

Hey henrique,

You can see the documentation of drop event https://www.bryntum.com/docs/grid/api/Core/helper/DragHelper#event-drop

That we have a grabbed property which will have the information about the node which started the drag/drop action, is that the information that you're looking for?? Could you provide more context about how you set up the events?

Besides that, you could also try to add a breakpoint using dev tools, and then follow the function chain to check from where it was called.


Re: [INFO REQ] Double execution event

Posted: Mon Oct 03, 2022 9:17 pm
by henrique

How is the name of the function to generate the sample application to send to you?


Re: [INFO REQ] Double execution event

Posted: Mon Oct 03, 2022 10:06 pm
by henrique

I found the function, downloadTestCase, but it's given me a stack overflow...


Re: [INFO REQ] Double execution event

Posted: Mon Oct 03, 2022 11:23 pm
by marcio

What error is being displayed for you??? Could you please share a screenshot?


Re: [INFO REQ] Double execution event

Posted: Tue Oct 04, 2022 3:10 pm
by henrique

I found the problem. It was another framework that we used to create div, it was removed, and everything work as expected.


Re: [INFO REQ] Double execution event

Posted: Tue Oct 04, 2022 3:25 pm
by marcio

Thanks for the clarification Henrique and glad that everything is working now. :)


Re: [INFO REQ] Double execution event

Posted: Tue Oct 04, 2022 8:35 pm
by henrique

Sorry, isn't the another framework, but the hidden property of the grid.

In the sample below, every time you click in the button, and change the record position, will gerenate an event in the onGridRowDrop. If you click 5 time in the button, will generate 5 times the "passed here", in the console.

import { Button, Grid, DataGenerator, MessageDialog } from '../../build/grid.module.js?462345';
import shared from '../_shared/shared.module.js?462345';

const grid = new Grid({

appendTo : 'container',

features : {
    rowReorder : {
        showGrip  : true,
        callOnFunctions: true,
onGridRowDrop()
{
console.log("passed here");
}
        }
    },

// Headers will ripple on tap in Material theme
ripple : {
    delegate : '.b-grid-header'
},

multiSelect : true,

columns : [{
    text   : 'Name',
    field  : 'name',
    flex   : 2,
    editor : {
        type     : 'textfield',
        required : true
    }
}, {
    text  : 'Age',
    field : 'age',
    width : 100,
    type  : 'number'
}, {
    text  : 'City',
    field : 'city',
    flex  : 1
}, {
    text  : 'Food',
    field : 'food',
    flex  : 1
}, {
    text     : 'Color (not sortable)',
    field    : 'color',
    flex     : 1,
    sortable : false,
    renderer : ({ cellElement, value }) => {
        // renderer that sets text color = text
        cellElement.style.color = value;
        return value;
    }
}],

tbar : [
    {
        type    : 'checkbox',
        ref     : 'confirmationButton',
        text    : 'Show confirmation dialog',
        checked : false
    },
    {
        type    : 'checkbox',
        text    : 'Show grip icon',
        checked : true,
        onAction() {
            grid.features.rowReorder.showGrip = this.checked;
        }
    }
],

data : DataGenerator.generateData(50)

});

const button = new Button({
    appendTo : 'container',
text: 'click here',
onClick()
{
   grid.hidden = !grid. Hidden;
}
});

Re: [INFO REQ] Double execution event

Posted: Tue Oct 04, 2022 9:40 pm
by marcio

Hey henrique,

Which version are you using?? I tested in the last version and didn't get that console.log (attached a video to show that)


Re: [INFO REQ] Double execution event

Posted: Tue Oct 04, 2022 9:59 pm
by henrique

After click, must move the record, change the position of it.

I'm using the last version, 5.1.4.