-
7 Aug 2012 9:29 AM #1
Ext.data.Record.create fails
Ext.data.Record.create fails
Hi,
From everything I can tell about reading the docs and checking the forums, the following should work:
var MyRecord = Ext.data.Record.create(
[
{name: "id", type: "string"},
{name: "action", type: "string"},
{name: "category", type: "string"},
{name: "authorized", type: "boolean"}
]
);
However in chrome I see the following error:
Uncaught TypeError: Cannot read property 'items' of undefined
fields = me.fields.items;
Uncaught TypeError: Cannot read property 'items' of undefined
length = fields.length;
In FF:
TypeError: me.fields is undefined
Any idea what I am doing wrong here.
Thanks in advance for any help or pointers on this.
-
7 Aug 2012 1:51 PM #2
What you want to accomplish with that?
Use Model instead.
Regards.UI: Sencha Architect 2.x / ExtJS 4 MVC
Server side: EJB 3.1 / CDI / JPA 2 / JAX-RS / JasperReports
Application Server: Glassfish 3.1.x
Databases: Oracle 10g & 11g / DB2 9 & 10 / Firebird 2.5
If you like my answer please vote!
-
7 Aug 2012 2:22 PM #3
I was trying to add a record/data entry to the store. The above way is what the documentation and the forums said to do. However I later found out that:
var record = ({
id: Ext.id(),
action: "startnow",
categroy: "red-dog",
authorized: true
});
store.add(record);
works just fine. It not clear why the documentation showed the other way.
-
7 Aug 2012 3:02 PM #4
Are you sure you are looking into ExtJS4 / Touch 2 documentation?
In SA you should create a Model then use it like:
var record = Ext.create("Mymodel", {...});
store.add() can receive an object or model instance.
Regards.UI: Sencha Architect 2.x / ExtJS 4 MVC
Server side: EJB 3.1 / CDI / JPA 2 / JAX-RS / JasperReports
Application Server: Glassfish 3.1.x
Databases: Oracle 10g & 11g / DB2 9 & 10 / Firebird 2.5
If you like my answer please vote!


Reply With Quote