1. #1
    Sencha User amitkahan's Avatar
    Join Date
    Mar 2011
    Location
    Mahuva
    Posts
    18
    Vote Rating
    0
    amitkahan is on a distinguished road

      0  

    Default Answered: Access Store Meta Data

    Answered: Access Store Meta Data


    I have my data as below loaded by store

    what is the best way to access meta data, in below case "custom_one", "custom_two", or please suggest any other way?

    Code:
    {    
        "total": "20",
        "custom_one": "abc",
        "custom_two": "efg",
    
        "tasks": [{
            "id": "1",
            "project_id": "1",
            "title": "My First Task",
            "description": "My First Task Description",
            "status": "pending",
            "date_created": "13-03-1986",
            "date_completed": "14-03-1986",
            "date_invoiced": "15-03-1986"
        }, {
            "id": "2",
            "project_id": "1",
            "title": "My Second Task",
            "description": "My First Task Description",
            "status": "pending",
            "date_created": "13-03-1986",
            "date_completed": "14-03-1986",
            "date_invoiced": "15-03-1986"
        }]
    }
    My store is as below:

    Code:
    Ext.define('MTT.store.Tasks', {
        
        extend: 'Ext.data.Store',
    
        config: {
            autoLoad: true,
            model: 'MTT.model.Tasks',
    
    
            proxy: {
                type: 'jsonp',
                url: 'http://localhost/amit/mtracktasks/MTT/data/tasks.php',
    
    
                reader: {
                    type: 'json',
                    idProperty: 'id',
                    rootProperty: 'tasks'
                }
            },
            
            filters: {
                property: 'status',
                value: /pending/
            }
        }
    });
    My Model is as below:

    Code:
    Ext.define('MTT.model.Tasks', {
    
        extend: 'Ext.data.Model',
    
        config: {
            fields: [{
                name: 'id',
                type: 'int'
            }, {
                name: 'project_id',
                type: 'int'
            }, {
                name: 'title',
                type: 'string'
            }, {
                name: 'description',
                type: 'string'
            }, {
                name: 'status',
                type: 'inclusion',
                list: ['pending', 'completed', 'invoiced']
            }, {
                name: 'date_created',
                type: 'date',
                dateFormat: 'd-m-Y'
            }, {
                name: 'date_completed',
                type: 'date',
                dateFormat: 'd-m-Y'
            }, {
                name: 'date_invoiced',
                type: 'date',
                dateFormat: 'd-m-Y'
            }]
        }
    });
    Can you please give a link or an example?

    Thanks in advance.

  2. Below is a piece of my code. You could access the rawData property to access the raw data object.


    http://docs.sencha.com/touch/2-0/#!/...operty-rawData

    Let us know if anyone knows the better way to do it.
    Code:
    updateScreen: function(){
        var rawData = this.getStore().getProxy().getReader().rawData;
        console.log(rawData.custome_one, rawData.custome_two);
    },

  3. #2
    Sencha User
    Join Date
    Apr 2012
    Location
    Toronto, Canada
    Posts
    92
    Vote Rating
    12
    Answers
    20
    iSmartDevice is on a distinguished road

      1  

    Default


    Below is a piece of my code. You could access the rawData property to access the raw data object.


    http://docs.sencha.com/touch/2-0/#!/...operty-rawData

    Let us know if anyone knows the better way to do it.
    Code:
    updateScreen: function(){
        var rawData = this.getStore().getProxy().getReader().rawData;
        console.log(rawData.custome_one, rawData.custome_two);
    },

  4. #3
    Sencha User amitkahan's Avatar
    Join Date
    Mar 2011
    Location
    Mahuva
    Posts
    18
    Vote Rating
    0
    amitkahan is on a distinguished road

      0  

    Default


    Got it!! Thank You Very Much!!
    Amit Sidhpura
    Owner, Kahan

    Email ID: amit@kahan.in
    Homepage: www.kahan.in

Thread Participants: 1

Tags for this Thread