ExtJS网格回调加载和重新加载

Man*_*era 2 php json extjs callback

我有一个Ext Grid,想要获取JSON"success":false/true response为每种情况执行一个函数.我想将它作为每个网格与JSON PHP文件交互的回调函数.

这有什么例子吗?

感谢您的时间.

tsg*_*tsg 8

您需要将回调注册到JsonStore 的加载异常事件.像这样的东西:

 var grid = new Ext.grid.GridPanel({
     store: new Ext.data.JsonStore({
          [...]
          listeners: {
               load: this.onLoadSuccess.crateDelegate(this),
               exception: this.onLoadException.createDelegate(this)
          }
     }),

     onLoadSuccess: function () {
          // success
     },

     onLoadException: function () {
         // error
     },

     [...]
 }
Run Code Online (Sandbox Code Playgroud)