PDA

View Full Version : Grid not populating columns.



mazhar.shaikh
10 Mar 2013, 12:35 PM
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><d2p1:stockOnHand>0</d2p1:stockOnHand><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><d2p1:stockOnHand>0</d2p1:stockOnHand><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


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:


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]);

}
}
});

evant
10 Mar 2013, 3:39 PM
Your data is XML, but you have told the reader to be a JSON type. Suggest reading the docs for Ext.data.reader.Xml.

mazhar.shaikh
10 Mar 2013, 3:43 PM
I was missing the "ROOT" config on the reader.
Setting it to "Lines" populates my grid.