Param,
I'm having a similar issue. I have the validations set up for various columns but they don't fire automatically. So I tried explicitly invoking isValid on cellSave like this:
j$("[id=custom_grid]").pqGrid({
cellSave: function( event, ui ) {
var colM=j$( "[id=custom_grid]" ).pqGrid( "option" , "colModel" );
var isValid = j$("[id=custom_grid]").pqGrid( "isValid" , { rowIndx: ui.rowIndx, dataIndx: ui.dataIndx, value: ui.newVal } );
if(isValid.valid == false) {
alert(ui.newVal + " " + colM[ui.dataIndx].validations[0].msg);
j$("[id=custom_grid]").pqGrid( "isValid" , { rowIndx: ui.rowIndx, dataIndx: ui.dataIndx, value: ui.newVal } );
}
}
});
When I try to tab to the next cell, it does pop up a message when the cell value is invalid but allows the value to be still there. Is there a way to just change the cell value to an empty string?
I also tried this:
j$("[id=custom_grid]").on( "pqgridcellsave", function( event, ui ) {
var isValid = j$("[id=custom_grid]").pqGrid( "isValid" , { rowIndx: ui.rowIndx, dataIndx: ui.dataIndx, value: ui.newVal } );
if (!isValid) {
j$("[id=custom_grid]").find(".pq-editor-focus").css({ "border-color": "red" });
return false;
}
evt.stopPropagation();
});
On tabbing to the next cell, the validation fires but the cursor stays in the cell and I need to hover on the cell to see the validation error. Then I can move on to the next cell with the contents of the previous cell hidden but still containing the erroneous value. I wonder if I might be missing something in how the validations are supposed to work - I was hoping for something more automatic and that could stop you in your tracks if you entered an invalid value. If not, just being able to nullify the value may be the plan B here.
Thanks,
Ram