I have nameProperty set in the proxy of my store like this : Code:
我在我的商店的代理中设置了nameProperty,如下所示:代码:
writer : {
type : 'json',
nameProperty : 'mapping',
root : 'PerVO'
}
And in my model , the mapping like this:
在我的模型中,映射如下:
{
name : 'modules',
mapping : 'modules.collection',
defaultValue: []
},
This works fine when I call the CRUD operations on the store. Now I want to get the data in the format being sent to the server for other operations. The problem is that when I get the record from the store , the mapping is lost. So how can I useExt.data.writer.Json or some other api to generate the data EXACTLY as it would be generated while being sent to the server with mapping applied :
当我在商店调用CRUD操作时,这很好用。现在我想以格式将数据发送到服务器以进行其他操作。问题是,当我从商店获取记录时,映射将丢失。那么我怎样才能使用.NET.data.writer.Json或其他一些api来生成数据,因为它会在发送到应用了映射的服务器时生成:
This is what the store sends for save (I need the data like this. Note : Difference is 'collection:')
这是商店发送保存的内容(我需要这样的数据。注意:差异是'集合:')
"modules": {
"collection": {
"isActive": 1,
"metadata": {
"actionCodes": "",
"memos": ""
},
"moduleCode": "OM",
"moduleId": 250,
"moduleName": "Org Management",
"success": false,
"viewId": 0
}
},
This is what i get from the store when the record is looked up:
这是我在查找记录时从商店获得的内容:
"modules": {
"isActive": 1,
"metadata": {
"actionCodes": "",
"memos": ""
},
"moduleCode": "OM",
"moduleId": 250,
"moduleName": "Org Management",
"success": false,
"viewId": 0
},
I need to get the data as sent by the store to server. Thanks Nohsib
我需要将商店发送的数据提供给服务器。谢谢Nohsib
1 个解决方案
#1
0
Simply change the name in the mapping to the following
只需将映射中的名称更改为以下内容即可
{
name : 'collection',
mapping : 'modules.collection',
defaultValue: []
}
The name
config is the name that is used within the model
. If you look at the data
property of a model
object, the name
used in the mapping is used to store the value in the model
. The name
is same name that we use while retrieving data from a model
object too. Ex. model.get(name);
名称config是模型中使用的名称。如果查看模型对象的data属性,则映射中使用的名称用于存储模型中的值。名称与我们从模型对象检索数据时使用的名称相同。防爆。 model.get(名称);
From the api.
来自api。
The name by which the field is referenced within the Model
模型中引用字段的名称
#1
0
Simply change the name in the mapping to the following
只需将映射中的名称更改为以下内容即可
{
name : 'collection',
mapping : 'modules.collection',
defaultValue: []
}
The name
config is the name that is used within the model
. If you look at the data
property of a model
object, the name
used in the mapping is used to store the value in the model
. The name
is same name that we use while retrieving data from a model
object too. Ex. model.get(name);
名称config是模型中使用的名称。如果查看模型对象的data属性,则映射中使用的名称用于存储模型中的值。名称与我们从模型对象检索数据时使用的名称相同。防爆。 model.get(名称);
From the api.
来自api。
The name by which the field is referenced within the Model
模型中引用字段的名称