Hiii all,我正在使用Extjs 4.2数据网格,我需要将我的'store'转换为json数组并将其发送到服务器端(即java).
这是我的模特.
Ext.define('Writer.Document',{
extend: 'Ext.data.Model',
fields: ['id', 'name', 'notes', 'Type', 'date']
});
Run Code Online (Sandbox Code Playgroud)
和我的商店(包含对象列表)是
var store = Ext.create('Ext.data.Store', {
model: 'Writer.Document',
autoLoad: true,
proxy: {
type: 'ajax',
url : 'findPatientRecordAction',
reader: {
type: 'json',
successProperty: 'success',
root: 'prognosis',
messageProperty: 'message'
}
fields: ['id','name', 'date', 'notes' , 'Type'],
},
});
Run Code Online (Sandbox Code Playgroud)
因此,当我在网格中提交值时,我需要在服务器端使用ist对象.所以我需要从客户端发送JSON数组.
任何人都可以帮我在这里如何从我的商店制作一个JSONArray对象并发送到服务器端???
问候:开发
我正在使用ExjJs 4.2.我有两个显示不同数据的网格.在一个javascript文件中,我必须包括两个网格.我正在为第一个网格加载商店
var store = Ext.create('Ext.data.Store', {
model: 'Writer.Person',
autoLoad: true,
proxy: {
type: 'ajax',
url : 'findPatientRecordAction',
reader: {
type: 'json',
successProperty: 'success',
root: 'data',
messageProperty: 'message'
},
writer: {
type: 'json',
encode: true,
root: 'data'
},
fields: ['id','notes', 'startDate', 'endDate'],
},
});
Run Code Online (Sandbox Code Playgroud)
JSON对象库如下所示:
"data":[{"id":35,"notes":"hiii","startDate":"2013-04-30","endDate":"2013-05-02"}]},"details" :[{ "ID":14, "文件": "docpath12345", "日期": "2013年4月28日"}]
实际上,第一个网格将仅显示JSON的"数据"部分,第二个网格将显示JSON的"详细信息"部分.理想情况下,我不应该为第二个网格再次加载商店对象(我现在正在做什么).我想再声明一个商店类型变量并重用'store'的值(商店的'documents'部分)成为将第二个网格存储为
我现在像这样加载第二家商店
var store2 = Ext.create('Ext.data.Store',{
model: 'Writer.Document',
autoLoad: true,
proxy: {
type: 'ajax',
url : 'findPatientRecordAction',
reader: {
type: 'json',
successProperty: 'success',
root: 'details',
messageProperty: 'message'
}, …Run Code Online (Sandbox Code Playgroud)