views:

7246

answers:

1

Hello. 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.

Any examples of this ?

Thank you for your time.

+4  A: 

You need to register callbacks to the load and exception events of the JsonStore. Something like this:

 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
     },

     [...]
 }
tsg