6

エンドユーザーがフォーム内のデータを変更できるグリッドのリストがあります。最後に、ボタンをクリックしてすべてのグリッドを同期したい場合、操作が実行されます。

以下のコードを書きました。

$.when.apply(
    Ext.ComponentQuery.query('grid')
       .forEach(function(item) {
             if (item.getXType() == "grid") {
                if (item.store.getNewRecords().length > 0 || item.store.getUpdatedRecords().length > 0 || item.store.getRemovedRecords().length > 0) {
                    item.store.sync();
                 }
             }
})).then(function (results) {
    //do something
});

問題はstore.sync()、コールバックを待っていないことです。

これを行うための推奨される方法は何ですか?

4

2 に答える 2