Hello!
I understand ExtJS, with varying success ...
Neither can I accept on the server the data sent by the Store when records are changed (added, modified or deleted). Writes that the data goes to POST , but on the server neither $ _POST , nor $ _GET , nor $ _REQUEST sent data shows - as if nothing was sent (well, except for the random value in $ _GET - _dc = 1357565039902 ).

That's what goes to the server (taken from the Chrome console), respectively, when deleting, updating and adding:

Request URL: http://localhost/service/destroy/news.php?_dc=1357565811429 Request Method:POST Status Code:200 OK Query String Parameters: _dc:1357565811429 Request Payload: {"items":{"id":5}} Request URL: http://localhost/service/update/news.php?_dc=1357566047052 Request Method:POST Status Code:200 OK Query String Parameters: _dc:1357566047052 Request Payload: {"items":{"datepubl":"2012-12-01T00:00:00","title":"the Update Plan","alias":"the-update-plan","new":"<p>small text new</p>","newfull":"<p>full text new</p>","id":4}} Request URL: http://localhost/service/create/news.php?_dc=1357566179903 Request Method:POST Status Code:200 OK Query String Parameters: _dc:1357566179903 Request Payload: {"items":{"id":0,"datepubl":null,"dateclose":null,"title":"the NEW new","alias":"the-new-new","new":"text the NEW new","newfull":""}} 

The following Store sends these requests:

 var storeNews = Ext.create('Ext.data.Store', { autoLoad: true, autoSync: true, idProperty: 'id', remoteFilter: true, fields: [ { name: 'id', type: 'int' }, { name: 'datepubl', type: 'date' }, { name: 'dateclose', type: 'date' }, { name: 'title', type: 'string' }, { name: 'alias', type: 'string' }, { name: 'new', type: 'string' }, { name: 'newtext', type: 'string' } ], proxy: { type: 'ajax', api: { read: 'service/view/news.php', create: 'service/create/news.php', update: 'service/update/news.php', destroy: 'service/destroy/news.php' }, reader: { type: 'json', successProperty: 'success', root: 'data', messageProperty: 'message' }, writer: { type: 'json', writeAllFields: false, root: 'data' }, listeners: { exception: function(proxy, response, operation){ Ext.MessageBox.show({ title: 'REMOTE EXCEPTION', msg: operation.getError(), icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); } } } }); 

Can you please tell me how to accept the transferred data to the server?
Or how to send them correctly, if I do it wrong? ..

    1 answer 1

    Everything is easier than it seems:

     $data = json_decode(file_get_contents('php://input')); 

    Store wants to get in response to get the finished look of this record. Only then will he be sure that this row of the table actually exists, and is not some kind of “fictional”. Each entry in the store has a phantom property. It means whether the record really exists, or it has temporarily appeared in the store. By adding the store will send all phantom records. When the store receives the records in the response, it will understand that the server has processed or saved it, and will assign the value phantom = false , that is, the record is real.

     print( json_encode( $data ) ); 

    If an entry is being added, then it must be assigned an ID , if this is the case.