Domanda

I want to send data from DhtmlxGrid in my MVC project. I have set some basic validation on grid cells which are working fine. But before submitting i want to check if is there any error in the grid. Right the data are being submitted to controller even if there any error occurs, which i want to block onSubmit.

Thanks for any help in advance :)

È stato utile?

Soluzione 2

Well I have found something. the problem was when i was going to use validation in multiple columns.

myGrid.setColValidators("NotEmpty,NotEmpty,,");

But is_invalid status of a row was undefined if i don't set the status of the row to true on an event

myGrid.attachEvent("onValidationError", function (id, ind, value) {
dpmygrid.set_invalid(id,true)
}

But when i correct one validation it automatically update the Is_Invalid status of row to false even there are still some other errors in the same row. So later on i used 'setUserData' to update the status of the grid row.

myGrid.attachEvent("onValidationError", function (id, ind, value) {
    myGrid.setUserData(id, ind, "error");
}

myGrid.attachEvent("onValidationCorrect", function (id, ind, value) {
    myGrid.setUserData(id, ind, null);
}

and before sumbit we can check the setUserData status of the row.

Altri suggerimenti

You can try to use validation through the dataprocessor. Here is a tutorial in the docs: http://docs.dhtmlx.com/doku.php?id=dhtmlxdataprocessor:configuring_debugging#validation

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top