我不确定我在这里做错了什么,但让我来设置场景。
现在,需要一个中间步骤,通过另一个存储获取更多数据,并将两个集合都传递给原始函数。
我已经尝试了下面的许多变体,但两个数据集似乎没有传递给updateLeftPanel函数,第一个在那里很好,第二个显示“未定义”。有什么明显的我遗漏了什么吗?
resultsStore.load({
params: {
'certid' : certId
},
callback: function(record,operation,success){
updateRightPanel(record[0].data); // code not shown,works fine
//updateLeftPanel(record[0].data); // original call
loadCriteriaStore(record[0].data); // new call
}
});
function loadCriteriaStore(data)
{
criteriaStore.load({
params: {
'edition' : data['Edition']
},
callback: function(record,operation,success,data){
updateLeftPanel(data,record[0].data);
// orig data first, new dataset second
}
});
}
function updateLeftPanel(data, dataa){
// code here
dataa object still unpopulated
}发布于 2013-02-06 00:06:52
在loadCriteriaStore函数的回调中,您将分配4个参数。我假设它只通过3次。
因此,在该回调中,包含您的数据的data将被一个新的“本地”data覆盖,即undefined。
function loadCriteriaStore(data)
{
criteriaStore.load({
params: {
'edition' : data['Edition']
},
// Get rid of the ",data" here
callback: function(record,operation,success){
// the `data` param will be the value passed to `loadCriteriaStore`
updateLeftPanel(data,record[0].data);
// orig data first, new dataset second
}
});
}https://stackoverflow.com/questions/14711321
复制相似问题