I have two grids in selector #tabela:
- $objOrcamento is the main grid
- $grid is the details grid
Now I want to handle events like cellBeforeSave, load, etc for both of them but I keep receiving the error:
Uncaught TypeError: Object #<Object> has no method 'pqGrid'
For example, to handle cellBeforeSave in $grid, I tried:
var $grid={
//colModel, dataModel, etc...
cellBeforeSave: function (evt, ui) {
var isValid = $grid.pqGrid("isValid", ui);
if (!isValid.valid) {
evt.preventDefault();
return false;
}
},
}
This isn't working, so I've tried outside var $grid:
$("#tabela").on("pqgridcellbeforesave", function (event, ui) {
var isValid = $grid.pqGrid("isValid", ui);
if (!isValid.valid) {
evt.preventDefault();
return false;
}
});
But this is generating the same error.
What is the correct way to handle events in multiple grids?
Thanks in advance for your help!