1. #1
    Sencha User
    Join Date
    Jun 2007
    Posts
    20
    Vote Rating
    0
    Valera is on a distinguished road

      0  

    Default Answered: How can I get data?

    Answered: How can I get data?


    PHP Code:
    {
        
    "a":7,
        
    "b":26,
        
    "c":40,
        
    "records":[
            {
    "aa":"1","bb":"2"}
            ]

    How can I get data a,b,c from Ext.data.Store ?

  2. The server JSON should return these values in the result set and you simply need to set these values in your reader and it will be used.

    Code:
    reader        : {
        type            : 'json',
        totalProperty   : 'total',
        successProperty : 'success',
        messageProperty : 'message',
        root            : 'items'
    },
    Scott.

  3. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,918
    Answers
    655
    Vote Rating
    443
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Is the data already in the store? Where do you want it? in a form?

    Scott.

  4. #3
    Sencha User
    Join Date
    Jun 2007
    Posts
    20
    Vote Rating
    0
    Valera is on a distinguished road

      0  

    Default


    in constructing the grid, I get the data, but can not apply to them

  5. #4
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,918
    Answers
    655
    Vote Rating
    443
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Here is a basic example:

    Code:
    {
        'items': [
            {
                'name': 'Lisa',
                'email': 'lisa@simpsons.com',
                'change': 100
            },
            {
                'name': 'Bart',
                'email': 'bart@simpsons.com',
                'change': -20
            },
            {
                'name': 'Homer',
                'email': 'home@simpsons.com',
                'change': 23
            },
            {
                'name': 'Marge',
                'email': 'marge@simpsons.com',
                'change': -11
            }
        ]
    }
    Code:
    Ext.onReady(function(){
    
        Ext.create('Ext.data.Store', {
            storeId:'simpsonsStore',
            fields:['name', 'email', 'change',],
            autoLoad: true,
            proxy: {
                type: 'ajax',
                url: 'data.json',
                reader: {
                    type: 'json',
                    root: 'items'
                }
            }
        });
    
        Ext.create('Ext.grid.Panel', {
            title: 'Simpsons',
            store: Ext.data.StoreManager.lookup('simpsonsStore'),
            columns: [
                { header: 'Name',  dataIndex: 'name' },
                { header: 'Email', dataIndex: 'email', flex: 1 },
                { header: 'Change', dataIndex: 'change' }
            ],
            height: 200,
            width: 400,
            renderTo: Ext.getBody()
        }); 
    
    });

  6. #5
    Sencha User
    Join Date
    Jun 2007
    Posts
    20
    Vote Rating
    0
    Valera is on a distinguished road

      0  

    Default


    need these data to obtain: (total,closed,itc BEFORE items)
    PHP Code:
    {
        
    'total':200,
        
    'closed':300,
        
    'itc':'zzz...'
        'items'
    : [
            {
                
    'name''Lisa',
                
    'email''lisa@simpsons.com',
                
    'change'100
            
    },
            {
                
    'name''Bart',
                
    'email''bart@simpsons.com',
                
    'change': -20
            
    },
            {
                
    'name''Homer',
                
    'email''home@simpsons.com',
                
    'change'23
            
    },
            {
                
    'name''Marge',
                
    'email''marge@simpsons.com',
                
    'change': -11
            
    }
        ]

    these data are easily transferred from the server after the recount than on the client

    sampl:
    1.png

    in order not to perform this function:

    PHP Code:
    var size 0; var foldersCount 0; var filesCount 0;
            
    this.store.each(function(record) {
                 if(
    record.get('filesize') !== '-'){
                     
    size  Number(size record.get('filesize'));
                     
    filesCount++;
                }
                else {
    foldersCount++;}
            }); 

  7. #6
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,918
    Answers
    655
    Vote Rating
    443
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Are you referring to the totalProperty, etc?

    Scott.

  8. #7
    Sencha User
    Join Date
    Jun 2007
    Posts
    20
    Vote Rating
    0
    Valera is on a distinguished road

      0  

    Default


    yes yes yes

    and any other data, not only totalProperty.

  9. #8
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,918
    Answers
    655
    Vote Rating
    443
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      1  

    Default


    The server JSON should return these values in the result set and you simply need to set these values in your reader and it will be used.

    Code:
    reader        : {
        type            : 'json',
        totalProperty   : 'total',
        successProperty : 'success',
        messageProperty : 'message',
        root            : 'items'
    },
    Scott.

  10. #9
    Sencha User
    Join Date
    Jun 2007
    Posts
    20
    Vote Rating
    0
    Valera is on a distinguished road

      0  

    Default


    Thank you!

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi