Passing Ext Store data to php
I have an EditorGridPanel on my page. My goal is to pass the updated data to PHP via POST开发者_StackOverflow中文版 method. Though I want it to happen only after clicking the Save Button. I know I can achieve it by converting the data to an array and sending it like a form, but is there a better way? I've tried using JsonWriter, but it sends requests every time I update data in the grid.
So what is the best way to do it?
JasonWriter is a good way to save your records, what you are missing is autoSave: false,
in store definition.
autoSave : Boolean
Defaults to true causing the store to automatically save records to the server
when a record is modified (ie: becomes 'dirty'). Specify false to manually
call save to send all modifiedRecords to the server.
Note: each CRUD action will be sent as a separate request.
Basicly you should write your own method for saving records. Most of availble examples focusing on sending just modified records var modified = Store.getModifiedRecords ();
followed by extracting and encoding, your need is to send all records will simplify that operation.
Sorry that I do not have on-line example handy, I base and I would recommend to look in "ExtJS in Action" by Jesus Garcia where is nice chapter about CRUD via EditGridPanel
Use jquery. On save button click event create your json and use $.post function.
精彩评论