开发者

EXTJS JsonStore not loading proeprly

开发者 https://www.devze.com 2023-03-06 02:24 出处:网络
I have a JSONStore like : OrdersStore = Ext.extend(Ext.data.JsonStore, { constructor: function(cfg) { cfg = cfg || {};

I have a JSONStore like :

OrdersStore = Ext.extend(Ext.data.JsonStore, {
constructor: function(cfg) {
cfg = cfg || {};
OrdersStore.superclass.constructor.call(this, Ext.apply({
storeId: 'ordersStore',
url: '/ajaxSupport.action',
root: 'rows',
baseParams: {
action: 'getorderlegsearchgrid'
},
fields: [
{
name: 'orderId'
}
]
},
cfg));
}
});
new OrdersStore();

This store is attached to a grid : 'pendingOrdersGrid'. When I do:

alert(Ext.util.JSON.encode(this开发者_开发问答.pendingOrdersGrid.getStore().getAt(0)));  

I hope to get the first record. But I get 'null'


I can't give you a complete answer from this information but some hints:

  • don't extend a store with a fixed storeId, url or fields! That's really bad design
  • if possible use browser that supports a console (Firefox with firebug or IE with developer toolbar [or FF4/IE9]) and debug the content of your store in the console.
  • to read the content of a record try something like this.pendingOrdersGrid.getStore().getAt(0).data.orderId
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号