1. #1
    Sencha User
    Join Date
    Feb 2013
    Location
    NZ
    Posts
    66
    Answers
    5
    Vote Rating
    0
    mazhar.shaikh is on a distinguished road

      0  

    Default Unanswered: Grid not populating columns.

    Unanswered: Grid not populating columns.


    My web service returns me the following result. I have a store to get these results, but I am not able to populate my grid that uses this store. Grid show one row consisting of 0's in all columns. How do I populate the grid to show to results returned by the web service. I am using ExtJs 4.

    <FilteredPicklistResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/AR.Store.Picklist"><ErrorMessage i:nil="true"/><ExceptionMessage i:nil="true"/><Lines xmlns:d2p1="http://advanceretail.com/store"><d2p1:pickListLinesProperties><d2p1:author>HEYLIN C</d2p1:author><d2p1:category>Performing Arts</d2p1:category><d2p1:floor>45.0000</d2p1:floor><d2p1:format>HardCover</d2p1:format><d2p1:id>0</d2p1:id><d2p1:isParked>false</d2p1:isParked><d2p1:isbn>9781740668026</d2p1:isbn><d2p1:lastReceipt>0001-01-01T00:00:00</d2p1:lastReceipt><d2p1:quantity>1</d2p1:quantity><d2p1:receiptQty>0</d2p1:receiptQty><d2p1tockOnHand>0</d2p1tockOnHand><d2p1:titleDescription>REVOLUTION IN THE AIR SONGS OF BOB DYLAN</d2p1:titleDescription><d2p1:webOrderNumber>3000001</d2p1:webOrderNumber></d2p1:pickListLinesProperties><d2p1:pickListLinesProperties><d2p1:author>STRAUSS N</d2p1:author><d2p1:category>REL</d2p1:category><d2p1:floor>50.0000</d2p1:floor><d2p1:format>Trade PaperBack</d2p1:format><d2p1:id>0</d2p1:id><d2p1:isParked>false</d2p1:isParked><d2p1:isbn>9781920885984</d2p1:isbn><d2p1:lastReceipt>0001-01-01T00:00:00</d2p1:lastReceipt><d2p1:quantity>-1</d2p1:quantity><d2p1:receiptQty>0</d2p1:receiptQty><d2p1tockOnHand>0</d2p1tockOnHand><d2p1:titleDescription>GAME</d2p1:titleDescription><d2p1:webOrderNumber>3000002</d2p1:webOrderNumber></d2p1:pickListLinesProperties></Lines><PicklistAvailable>true</PicklistAvailable><TotalOrders>2</TotalOrders><TotalTitles>2</TotalTitles></FilteredPicklistResult>
    Code for store is as follows

    Code:
    Ext.define('PickList.store.GeneratePicklist', {
        extend: 'Ext.data.Store',
    
    
        requires: [
            'PickList.model.GeneratePicklist'
        ],
    
    
        constructor: function(cfg) {
            var me = this;
            cfg = cfg || {};
            me.callParent([Ext.apply({
                autoLoad: false,
                remoteFilter: true,
                remoteSort: true,
                storeId: 'generatePicklist',
                model: 'PickList.model.GeneratePicklist',
                pageSize: 50,
                proxy: {
                    type: 'rest',
                    simpleSortMode: true,
                    headers: {
                        Accept: 'application/json',
                        'Content-Type': 'application/json'
                    },
                    reader: {
                        type: 'json',
                        idProperty: 'isbn',
                        totalProperty: 'totalRecords'
                    },
                    writer: {
                        type: 'json'
                    }
                },
                sorters: {
                    property: 'webOrderNumber'
                }
            }, cfg)]);
        }
    });
    Controller Code:

    Code:
    var store = Ext.getStore("GeneratePicklist"); 
    var url = PickList.globals.url + 'Orders/GeneratePickList?' + 'options=' + radio + '&maxTitles=' + maxTitles;
    store.proxy.url = url;
    console.log(url);
    
    
    store.load({
        params: { 
            start: 0,
            limit: PickList.globals.pageSize
        },
        scope : this,
        callback : function(records, operation, success){
            if (records.length > 0){
                this.application.log("Order Number: " + records[0].get('isbn'));
                this.application.log(records[0]);
                
            }
        }
    });

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,647
    Answers
    431
    Vote Rating
    583
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Your data is XML, but you have told the reader to be a JSON type. Suggest reading the docs for Ext.data.reader.Xml.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Sencha User
    Join Date
    Feb 2013
    Location
    NZ
    Posts
    66
    Answers
    5
    Vote Rating
    0
    mazhar.shaikh is on a distinguished road

      0  

    Default Found a solution

    Found a solution


    I was missing the "ROOT" config on the reader.
    Setting it to "Lines" populates my grid.

Thread Participants: 1

Tags for this Thread