PDA

View Full Version : Problem with ROw Editor and Double inserts in DB



nkkrustev
26 Mar 2010, 1:57 AM
Hello, i have the following problem:
I have a grid using MySQL database and i use it to inser/update/delete records in it. Using the Ext writer i update and delete fine
The problem occurs when i insert new records
i have the following code for add button



handler: function()
{
var u = new row2
({
name: ''
,
code: ''
,
version: ''
,
active: true
});
editor2.stopEditing();
ds2.insert(0, u);
u.commit();
grid2.getView().refresh();
grid2.getSelectionModel().selectRow(0);
editor2.startEditing(0);
}
I thought that this si the right way to use it with Row Editor: i first insert empty row, and as my php file watches for the xaction parameter this also inserts it in the DB (its what i need, as i need the row id for some operations and i can only have it after insert as its auto increment). After that i simply select it and use the row editor to update it with the info i actually want this record to have. The problem is that when the press the update button the row editor fires another create event instead of update one. This causes the php script to insert another record instead of editing the one i just inserted empty. This leads to having one blank row and one with the data i wanted to add. Is there a way around this...why the row editor sends xaction=create ???

I have tried to commit() the new added row, hoping that this will cause the editor to fire update even instead but it still sends create

nkkrustev
28 Mar 2010, 10:01 PM
BUMP