从变量中选择一个值 [英] Select a value from a variable
问题描述
在Extjs中,我尝试从变量 我试过: 上面一个没有工作。我收到错误: 未捕获TypeError:无法读取未定义的属性data 每当我添加 当我检查: 输出是: 0 //? 但是,如上图所示,可以看到 我还检查了: 输出是: [] 嗨Mr_Green你应该看看API有时是因为这是真的很直接;) 存储加载事件 更新 - 更深入 这个小字 on 将事件的侦听器应用于组件。它将适用于mixin Ext.util.Observable 我应用的最后一个参数标识了这个监听器在调用一次后应该被删除。这对匿名听众很有用,因为你不能取消注册。 加载(这个,记录,成功,eOpts) 参数 所以records参数包含所有记录由当前加载操作返回。 In Extjs, I am trying to select a value I tried: The above one is not working. I am getting error: Uncaught TypeError: Cannot read property 'data' of undefined Whenever I add When I checked: output is: 0 //? But I can see that there are items in I also checked: output is: [ ] Hey Mr_Green you should look into the API sometimes, cause this is really straight forward ;) Store load event Update - a bit more in depth The tiny word on applies a listener for a event to a component. It will be available for classes that mixin Ext.util.Observable where the last argument I applied identifies that this listener should get removed after it get called once. This is useful for anonymous listeners cause you cannot unregister them otherwise. load( this, records, successful, eOpts ) Parameters So the records argument contains all the records that are returned by the current load operation. 这篇关于从变量中选择一个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! Store
中选择 c
$ b
var newStore = Store.data.items [0] .data.accrued;
items [0]
,它使变量未定义。
var newStore = Store.data.items.length;
Store
变量中的项目。无论如何,我只想从变量 Store
中获取应计的价值
。
var newStore = Store.data.items;
Store.on('load',function(store,records){
records [0] .data.accrued;
}这个,{single:true})
accrued
from a variable Store
.var newStore = Store.data.items[0].data.accrued;
items[0]
, it is making the variable undefined.var newStore = Store.data.items.length;
Store
variable here as shown in the above image. Anyway, I just want to get the value of accrued
from the variable Store
.var newStore = Store.data.items;
Store.on('load', function(store,records){
records[0].data.accrued;
}, this, {single:true})