update only works after reload when using addrow +connector

hi,

I am using dhtmlx grid + connector (connected to a mysql-database). if I add a new data record with the addrow function

function addRow(){
var newId = (new Date()).valueOf()
mygrid.addRow(newId,[’’,‘test’,’’,’’,’’,’’,’’,’’,’’,’’,’’,’’,’’,’’,’’,’’,’’,’’],mygrid.getRowIndex(mygrid.getSelectedId()))
mygrid.selectRow(mygrid.getRowIndex(newId),false,false,true);
}

a new grid line is added but if I click to edit the data it is not updated correctly. The font color gets red and if I reload the page I see that nothing was updated. If I use addrow then reload the page and then update it works.
It has to do with grid not using the correct ID (auto increment is on). For example I use … [’’,‘test’,’’,’’,’’,’’,’’,’’,’’,’’,’’,’’,’’,’’,’’,’’,’’,’’]… in the above script, and the first “” is for the ID field. So if I know for example that the next ID will be “15” and I change the script to … [‘15’,‘test’,’’,’’,’’,’’,’’,’’,’’,’’,’’,’’,’’,’’,’’,’’,’’,’’]… the updating after addrow works as expected, but only for this ID.
So how can I get updating a grid cell after addrow with auto increment and connector to work?

Thanks!

The font color gets red
This means some error have occur on server side during data saving.
Try to enable logging in connector, and check logs - there must be detailed info ( most probably something SQL level error )

It has to do with grid not using the correct ID
Are you using ID field as one of columns in the grid?

viewtopic.php?f=10&t=12012

Are you using ID field as one of columns in the grid?

Yes ID is one field of the columns in the grid. I found out that everything works if I don´t use this field, which I do now. But this question remains:

:question: How can I use ID (with addrow + connector) as one of the colums in the grid while ID is an auto increment key field in the mysql database? I don´t want to edit ID (it should be just a ro field) but I would like to see the ID of each grid item.

Thanks for any information regarding this issue!

If ID is not auto-incremented and define on client side - above link and KeyGrid connector can be used.

If you are using normal, server side ID and just want to show it on the client side, it can be done but will require some extra coding on both client and sever sides. ( to ignore value of field during updates and auto-fills client with new value after insert )