1. #1
    Sencha Premium Member
    Join Date
    Jul 2012
    Posts
    61
    Vote Rating
    1
    dgherrig is on a distinguished road

      0  

    Default 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.

  2. #2
    Sencha Premium Member
    Join Date
    May 2010
    Location
    Guatemala, Central America
    Posts
    1,266
    Vote Rating
    80
    ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough

      0  

    Default


    What you want to accomplish with that?

    Use Model instead.

    Regards.
    UI: Sencha Architect 3.x / ExtJS 4 & 5
    Server side: JEE / EJB 3.x / CDI / JPA 2.x/ JAX-RS / JasperReports
    Application Server: Glassfish / WildFly
    Databases: Oracle / DB2 / MySQL / Firebird

    If you like my answer please vote!

  3. #3
    Sencha Premium Member
    Join Date
    Jul 2012
    Posts
    61
    Vote Rating
    1
    dgherrig is on a distinguished road

      0  

    Default


    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.

  4. #4
    Sencha Premium Member
    Join Date
    May 2010
    Location
    Guatemala, Central America
    Posts
    1,266
    Vote Rating
    80
    ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough

      0  

    Default


    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 3.x / ExtJS 4 & 5
    Server side: JEE / EJB 3.x / CDI / JPA 2.x/ JAX-RS / JasperReports
    Application Server: Glassfish / WildFly
    Databases: Oracle / DB2 / MySQL / Firebird

    If you like my answer please vote!

Thread Participants: 1