私のApp.NodesIndexController
中で私は次のようなことをしています:
destroyAllRecords: function () {
var _this=this;
Bootstrap.ModalPane.popup({
heading: 'Warning',
message: 'Are you sure you want to delete all nodes?',
primary: 'Ok',
secondary: 'Cancel',
showBackdrop: true,
callback: function(opts, event) {
if (opts.primary) {
_this.forEach(function(node) {
console.log('Deleting node %o', node);
node.deleteRecord();
});
var store = _this.get('store').commit();
store.commit();
store.on('didDelete', toggleMessageTray.bind(this, 'All nodes have been successfully deleted'));
}
}
});
}
しかし、実際には「ストアが更新されました」イベントを聞く方法がわかりません。個々のnodes
didDelete
イベントをリッスンするのではなく、コミットが実行された後にトリガーされるグローバル ストア イベントをリッスンします。
3 つの質問:
- そのようなイベントはありますか?
- 店舗イベントはどこで定義されますか? 私はそれについての文書を見ません (これは私がストアについて知っている唯一の文書です)
- ループ内の各レコードを削除するよりも、すべてのレコードを削除するより良い方法はありますか?