Hybrid View
-
23 Aug 2011 2:35 AM #1
Answered: problem creating a new record and updating a new record in a store
Answered: problem creating a new record and updating a new record in a store
Dear All,
I am facing one problem.
I want to add new record to my existing store and also want to modify some records in the store. but I am not able to my code is
but it is saying RecTOUp is not a constructor.Code:var RecToUp = Ext.getCmp("transGridId").getStore().recordType; var r = new RecToUp({ T10F2: this.Trans_key, T6F2: this.NameKey, }); r.commit(); store.add(r); store.commitChanges();
So please help me what is wrong here
thanks
-
Best Answer Posted by skirtle
Please indent your code so that it is readable before you post it.
You don't need to create the record yourself. You can just do something like this:
It will create the record for you from the model.Code:Ext.getCmp("transGridId").getStore().add({ T10F2: this.Trans_key, T6F2: this.NameKey });
-
23 Aug 2011 11:59 AM #2Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- Frederick MD, NYC, DC
- Posts
- 16,167
- Vote Rating
- 28
- Answers
- 83
try using Ext.getCmp("transGridId").getStore().model.create();

Jay Garcia @ModusJesus || Modus Create co-founder
Ext JS in Action author
Sencha Touch in Action author
Get in touch for Ext JS & Sencha Touch Touch Training
We are also working on Video-based Sencha Touch training: Check it out here.
-
23 Aug 2011 12:32 PM #3
Thanks,
I tried but it also didnot work.
Still showing the same error
Please help me out
thanks
-
23 Aug 2011 9:24 PM #4
Which version of ExtJS are you using?
-
23 Aug 2011 9:33 PM #5
I am doing everything with ext designer
the ext version is ext-4.0.2a.
I also tried
Code:var ObjectRecordType = Ext.data.Record.create(['T10F2', 'T6F2' ]); var rec = new ObjectRecordType({ T10F2: thisTrans_key, T6F2: "ram"}); Ext.getCmp("transGridId").store.add(rec);
but this is also not working.
I dont want to reload my store all the time to refresh the grid so please do helo me
thanks
-
23 Aug 2011 9:52 PM #6
Please indent your code so that it is readable before you post it.
You don't need to create the record yourself. You can just do something like this:
It will create the record for you from the model.Code:Ext.getCmp("transGridId").getStore().add({ T10F2: this.Trans_key, T6F2: this.NameKey });


Reply With Quote