EasyUI Forum
September 14, 2025, 04:43:10 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Datagrid - Deleting a newly created row  (Read 15225 times)
swader
Newbie
*
Posts: 11


View Profile
« on: March 27, 2012, 11:29:28 PM »

When I add a new row to my datagrid with the detailview helper, the values are populated properly because I call "reload" immediately afterwards. But the new row, as an object, has only one value: Object { isNewRecord=true}. Now, when I punch delete, it tells me it can't find the given index,

Code:
data.rows[_49f] is undefined
[Break On This Error]

_3ca(_4a2,opts.idField,data.rows[_49f][opts.idField]);

Now, if I refresh, this row is ok and can be deleted. But I can't delete it IMMEDIATELY after creating it, and I would like to.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: March 28, 2012, 01:42:09 AM »

If you define the 'idField' property, every records should have a key field. Add key field to your added record or remove the 'idField' property from datagrid.
Logged
swader
Newbie
*
Posts: 11


View Profile
« Reply #2 on: March 28, 2012, 02:36:36 AM »

Removing the idField from datagrid worked, thanks!
What does that option do, anyway? I couldn't figure it out from the documentation.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #3 on: March 28, 2012, 03:34:03 AM »

The idField indicate the key field, it is not necessary. If the idField is set, the selected records will be remembered while navigating records through multi page.
Logged
swader
Newbie
*
Posts: 11


View Profile
« Reply #4 on: March 28, 2012, 03:46:36 AM »

Interesting, thank you! That might come in handy later on.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!