php 加载和重新加载时的 ExtJS 网格回调

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1468779/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 02:44:25  来源:igfitidea点击:

ExtJS grid callback on load and reload

phpjsonextjscallback

提问by Manny Calavera

I have an Ext Grid and want to grab the JSON "success":false/true response an execute a function for each situation. I would like to have it as callback function for every grid interaction with the JSON PHP file.

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

Any examples of this ?

这有什么例子吗?

Thank you for your time.

感谢您的时间。

回答by tsg

You need to register callbacks to the loadand exceptionevents of the JsonStore. Something like this:

您需要注册对 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
     },

     [...]
 }