Ext Js - 如何引用存储值
我正在尝试从表单的加载事件中读取网格值。 orderStore.load() 使用数据加载我的网格,但我没有使用 getAt 返回记录。有更好的方法吗?谢谢。
client_form.on({
actioncomplete: function(form, action){
if(action.type === 'load'){
var suite_no = action.result.data.suite_no;
ordersStore.baseParams.suite_no = suite_no;
ordersStore.load();
var orderRec = Ext.data.Record.create(['order_id', 'suite_no', 'merchant', 'track_no', 'invoice_no', {name:'total',type: 'float'}, {name:'weight',type: 'float'}, 'status']);
var orderRec = ordersStore.getAt(0);
Ext.Msg.alert('rec=', orderRec);
}
}
});
I'm trying to read grid values from within a load event of my form. The ordersStore.load() loads my grid with data, but I don't get a record returned using getAt. Is there a better way to do this? Thanks.
client_form.on({
actioncomplete: function(form, action){
if(action.type === 'load'){
var suite_no = action.result.data.suite_no;
ordersStore.baseParams.suite_no = suite_no;
ordersStore.load();
var orderRec = Ext.data.Record.create(['order_id', 'suite_no', 'merchant', 'track_no', 'invoice_no', {name:'total',type: 'float'}, {name:'weight',type: 'float'}, 'status']);
var orderRec = ordersStore.getAt(0);
Ext.Msg.alert('rec=', orderRec);
}
}
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题是ordersStore.load()是异步的(文档是这么说的)。数据将在稍后到达,并且在之后(您要查找的位置)不会立即可用。
您需要添加一个“加载”事件处理程序。在该函数中,您可以检查数据,因为届时将加载数据。
The problem is that ordersStore.load() is asynchronous (the docs say-so). The data will arrive at a later point, and is not available immediately after (where you're looking for it).
You need to add a 'load' event handler. In that function, you can examine your data since it will be loaded at that time.