PDA

View Full Version : Problem with rows added in EditorGridPanel



daneseale
7 Jul 2010, 1:06 PM
The situation is the following:
I have a EditorGridPanel and a Store that read data from server.
I see data from the server when the page is loaded.

[my Store]
var users = new Ext.data.Store({
url: 'Users.action',
reader: new Ext.data.XmlReader({
record: 'row',
id: 'username'
}, [
'username',
'password',
'enabled',
'admin_role',
'user_role'
])
});

The problem is when i add a new row in the grid.

[Code]
grid.getStore().insert(
0,
new ds_model({
username: text,
password: 'newpassword',
enabled: 'no',
admin_role: 'no',
user_role: 'no'
})
);

where ds_model is:

[Record]
var ds_model = Ext.data.Record.create([
'username',
'password',
'enabled',
'admin_role',
'user_role'
]);

i see perfectly the new record in the grid, but when the method

listeners: {
afteredit: function(e){
Ext.Msg.alert(e.record.id, e.value);
....
run, if i was editing a record just added the message show is "ext-record-3", otherwise, if i was editing a record just loaded in the grid (from server) i see the text of username text field.
I would see the text of username text field of last row edited independently that it is a new row or not.

Thanks for your time.

Ale. D.