Threaded View

  1. #1
    Sencha User
    Join Date
    Feb 2012
    Vote Rating
    vtu is on a distinguished road


    Default Answered: Dynamic Store using metadata Null model and fields

    Hi I'm having an issue with my store using metadata. I get null values for model and fields when i do store.getFields() or store.getModel(). The store contains the relevant data in this case the users but the model and fields of the store is null. I would like to know what I'm missing in order to populate the fields and model. Thanks
    I'm using json similar to the following for testing.

    "msg":"Users found",
    "users":[{"userId":123,"name":"Ed Spencer","email":""}],
    "metaData":{"idProperty":'userId',"rootProperty":"users","totalProperty":'count',"successProperty":'ok',"messageProperty":'msg', "fields":[ { "name": "userId", "type": "int" }, { "name": "name", "type": "string" }, { "name": "email", "type": "string" }
    ] }

    My ModelExt.define('DST.model.DynamicModel', {
    extend: '',
    config: {
    fields: []

    My Store
    Ext.define('', {
    extend: '',
    model: 'DST.model.DynamicModel',
    proxy: {
    type: 'ajax',
    url: 'app/data/dynamictest.json',
    reader: {
    type: 'json',
    idProperty: 'id',
    rootProperty: 'root',
    totalProperty: 'total',
    successProperty: 'success',
    messageProperty: 'message'
    timeout: 10000

    Last edited by vtu; 6 Sep 2012 at 8:53 AM. Reason: make it more readable

  2. You would need to extend the reader and capture when it decodes the response so you can create your model.

Thread Participants: 1

Tags for this Thread