PDA

View Full Version : Adding a new record in Store



Sandeesh
29 Jun 2011, 11:44 PM
Hi,
How do you add a new record in store at runtime (eg:-on an event).
The grid should also refresh showing the added record.
It could be a blank data that is added to the store.
Thanks in advance

Uberdude
30 Jun 2011, 1:47 AM
Try reading the documentation: http://dev.sencha.com/deploy/ext-3.4.0/docs/

bryall
30 Jun 2011, 7:45 AM
Uberdude, try not to be a prick. Don't reply to something if you can't actually help. ;)

To answer your question you would get the stores recordType.

Example:


var r = myStoreVariable.recordType;
var insertRec = new r({ name: 'Me', text: 'Hello!' }); // the keys would be equal to your fields param
myStoreVariable.add( [ insertRec ] );


So you get the store's recordType, create a new record from the recordType, and then insert it into your store.

Uberdude
30 Jun 2011, 8:16 AM
Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime.