开发者

submit changes on extjs roweditor grid

I have a grid what update my database (via PHP) with JSON record. I want to know, how the data writed - record or not. I have an answer from PHP (true or false) to the grid, but dont know how to use it. How my grid can use this answer? (success event?)

Now, for example, User added new record without id at database (and i need this id for the future开发者_C百科 update), php answer what record saved(true) and told me id of new record. How I should work with it?

And I saw somehere some beauty flowing from the top of screen windows - how do the called? Sorry for typically questions, but I cant find answer for it.

Thanks.


If you are using Ext.Ajax.request to make the connection this is how you do it.

Ext.Ajax.request({
   url: 'ajax_demo/sample.json',
   success: function(response, opts) {
      var obj = Ext.decode(response.responseText);
      console.dir(obj);
   },
   failure: function(response, opts) {
      console.log('server-side failure with status code ' + response.status);
   }
});

There is a success callback function you specify which gets the response from the server which is a JSON object. This is where you can send things back and then manipulate your roweditor grid however you like.

Success also doesn't mean that everything went ok, it just means the request did not produce an html error code 4xx or 5xx.

The failure callback function is what to do if the server returns an error code for the AJAX request.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜