当调用model.erase({failure ...,success ...})即使服务器使用HTTP StatusCode 500响应,模型也会被删除。失败侦听器被正确触发,但我期望该模型不会被销毁。我可以看到它被销毁,因为它被从商店中删除。Sencha extjs model.erase即使在服务器错误时也会删除模型
var rec = store.getAt(index);
rec.erase({
success:function(record, operation){
// Do something to notify user knows
}
failure:function(record, operation){
// correctly triggered when HTTP = 40x or 50x
// Would expect that record is still in store. Why not?
// Of course i could add it again to store with store.add(record) but is that the prefered way?
}
});
我在ExtJS的6.0
那么这将是赶上这种情况下,最好的方法是什么? – Rob
在模型上调用'reject'来重置掉落的状态,然后重新添加到商店,如果这是你想要发生的事情。 –
好吧,我明白了。已经猜到了,但是它被添加到了不同的位置。 extjs方式没有更好的方法吗? – Rob