Sencha Touch是否有与jquery defferend类似的方法?
$.when(
// Deferred object (probably Ajax request),
// Deferred object (probably Ajax request),
// Deferred object (probably Ajax request)
).then(function() {
// All have been resolved (or rejected), do your thing
});
让我们说,等待3个商店加载并在之后做点什么?
答案 0 :(得分:1)
这是我的示例代码:
Ext.getStore('Store1').load({ callback: createGrid });
Ext.getStore('Store2').load({ callback: createGrid });
var loadedStores = 0;
function createGrid() {
loadedStores = loadedStores + 1;
if (loadedStores === 2) {
grid = Ext.create('Ext.grid.panel', {
...
});
)
}
不太好,但它有效且可扩展。