This should be easy, but I’m having trouble finding the answer. I have a grid with grid1.load("contactsCategory.php", function(){
grid1.loadOrderFromCookie();});
A DataProcessor with
var dp1 = new dataProcessor("contactsCategory.php"); dp1.init(grid1); dp1.sendData();
And a form with form1a.bind(grid1); form1a.attachEvent("onButtonClick", function(id){
if(id=="submit"){form1a.save(); dhxLayout.dhxWins.window("addContacts").hide();}
else if(id=="cancel"){
form1a.clear();
dhxLayout.dhxWins.window("addContacts").hide()
;}
});
But when I click submit, I get a javascript error from dhtmlxgrid.js, line 189 “d is null”. The debugger log has: Initiating data sending for all rows
row [object Object] marked [updated,valid]
Initiating data sending for [object Object]
Error! row with such ID not exists [object Object]
Initiating data sending for all rows
I tried adding grid1.addRow(); before form1a.save();, but that didn’t help. Any ideas?
When calling form.save(), form will try to push data back to master grid, but if you have not selected row in grid previous, it will fail - as it is not linked to any row in grid and can’t push data.
Form binding is a good way for editing data, but if you want to add new row you need to
add new row
select it ( can be done programmatically )
After that form will show data of the newly created row, and calling form.save() will correctly update it in grid and will send data to the server side.