Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
445
Events inside grid runs equals to the time i open the dialog box..
posted

hi guys, i have declare an event on a grid, that grid is inside a dialogbox.

when i open the dialog box i load the date onto the grid, and initialize events...

the problem is that if i open and close the dialog box 3 times, and then open again, if i select the row checkbox the event runs 3 times? 

what am i doing wrong?

$("#grid_Choose_Modulos_From_All_Processos").bind('iggridrowselectorscheckboxstatechanged', function (e, ui) {
//$(document).live("#grid_Choose_Modulos_From_All_Processos", "iggridrowselectorscheckboxstatechanged", function (evt, ui) {
if (ui.state == "on") {
if (!ui.isHeader) {
IDLicenca = ui.row.attr("data-id");
_arrIDsModulosSelecionadosOnGridChooseModulosToLicenca.push(IDLicenca);
_arrIDsModulosSelecionadosOnGridChooseModulosToLicenca = $.unique(_arrIDsModulosSelecionadosOnGridChooseModulosToLicenca);
console.log(_arrIDsModulosSelecionadosOnGridChooseModulosToLicenca);
}
}
else {
if (!ui.isHeader) {
IDLicenca = ui.row.attr("data-id");
var pos = $.inArray(IDLicenca, _arrIDsModulosSelecionadosOnGridChooseModulosToLicenca);
if (pos > -1) {
_arrIDsModulosSelecionadosOnGridChooseModulosToLicenca.splice(pos, 1);

}
console.log(_arrIDsModulosSelecionadosOnGridChooseModulosToLicenca);
}
}

});

what am i doing wrong?

Parents
No Data
Reply
  • 445
    Verified Answer
    posted

    sorry, stupid mistake, i cant declare an event every time i open the dilog box..

    if i do that, when the dialog box open it creates a new instance of the event...

    if i open the dialog 3 times, it creates 3 instances of the event, and when i select the checkbox the message appears 3 times

    sorry for  asking this...

Children
No Data