繁体   English   中英

将Ext Store数据传递到php

[英]Passing Ext Store data to php

我的页面上有一个EditorGridPanel。 我的目标是通过POST方法将更新的数据传递给PHP。 虽然我希望仅在单击“保存”按钮后才发生。 我知道我可以通过将数据转换为数组并将其像表单一样发送来实现,但是还有更好的方法吗? 我尝试使用JsonWriter,但是每次更新网格中的数据时,它都会发送请求。

那么什么是最好的方法呢?

JasonWriter是保存记录的好方法,您所缺少的是商店定义中的autoSave: false,

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.

基本上,您应该编写自己的保存记录的方法。 大部分可用示例仅关注发送已修改的记录var modified = Store.getModifiedRecords (); 其次是提取和编码,您需要发送所有记录将简化该操作。

抱歉,我没有方便使用的在线示例,我根据我的建议,建议您看一下Jesus Garcia撰写的“ ExtJS in Action”,其中是通过EditGridPanel撰写的有关CRUD的不错的一章。

使用jQuery。 在保存按钮单击事件上,创建您的json并使用$ .post函数。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM