Hi!
What is in your opinion is the best approach for keeping track of changed, inserted and deleted rows in a grid, without using the dataProcessor?
Rght now I do this:
- A couple of global variables store ID’s and row indexes of changed, inserted and deleted rows.
- User makes changes and hits Save-button
- The serialize function gets all XML which is sent to the server, along with the variables.
- On the server I loop thrugh all rows and make proper changes, deletes and inserts according to the affected rows
- ID’s for inserted rows are sent back to the client and updated in the grid
- Global vars are reset
It is a bit cumbersome, any other approch you recommend (without the dataProcessor)?
It seems like getChangedRows doesn’t return new rows.
Thanks!
If by some reason you can’t use dataprocessor, you can check “form integration” functionality, which do similar task ( it maintains the list of deleted|added rows and changed cells)
dhtmlx.com/docs/products/dhtmlxG … d_htmlform
The only other alternative to dataprocessor and form integration is the custom solution. Basically it is pretty simple on client side - onRowAdded and onBeforeRowDeleted events can be used to monitor row adding|deleting and serialization of changed rows used to serilaize only updated rows. The data on client side can be fully reloaded ( grid.clearAll, grid.loadXML ) to prevent any additional code for ID updating. ( Also you can define additional properties of grid object, to not use global vars )
>>It seems like getChangedRows doesn’t return new rows
getChangedRows will return only rows which is edit by user, you can mark any row as changed by
grid.cells(id,0).cell.wasChanged=true
Is there some special reason why dataprocessor can’t be used in your case? ( it must simplify data saving implementation )