2011-05-16 60 views
2

我有一个像JSONStore:EXTJS JsonStore不加载proeprly

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

这家店连接到网格: 'pendingOrdersGrid'。 当我做:

alert(Ext.util.JSON.encode(this.pendingOrdersGrid.getStore().getAt(0))); 

我希望得到的第一条记录。但我得到“空”

+2

你真的应该使用Firebug,这将让你的生活更容易,如果你正在处理的ExtJS – sra 2011-05-16 18:32:12

回答

0

我不能给你这个信息,但一些暗示一个完整的答案:

  • 不固定STOREID,URL或领域扩展商店!这是非常糟糕的设计
  • 如果可能的话使用支持控制台的浏览器(Firefox与firebug或IE与开发人员工具栏[或FF4/IE9])并在控制台中调试您的商店内容。
  • 读取记录的内容尝试一些像this.pendingOrdersGrid.getStore().getAt(0).data.orderId