>我有一个像 json
[
{
"switchType": {
"name": "sansayv15",
"perform": false,
"createBy": null,
"createDate": null,
"intId": 1,
"id": 1
},
"collectorType": {
"name": "FTP",
"perform": false,
"createBy": null,
"createDate": null,
"intId": 1,
"id": 1
},
"fileType": {
"name": "TEXT",
"perform": false,
"createBy": null,
"createDate": null,
"intId": 1,
"id": 1
},
"exportType": {
"name": "DB",
"perform": false,
"createBy": null,
"createDate": null,
"intId": 1,
"id": 1
},
"linesToSkip": "1",
"checkValidate": "true",
"checkDuplicate": "true",
"driver": "com.mysql.jdbc.Driver",
"url": "jdbc:mysql://localhost:3306/panamaxmediation",
"tableName": "sansayv15",
"ftpIp": null,
"ftpPort": null,
"ftpUserName": null,
"ftpPassword": null,
"sftpIp": null,
"sftpPort": null,
"sftpUserName": null,
"sftpPassword": null,
"name": "sansayv15",
"password": "root",
"userName": "root",
"perform": false,
"createBy": null,
"createDate": null,
"intId": 1,
"id": 1
}
]
这是作为我的服务的输出。我在两个存储中使用此输出 JsonResStore 和 ObjectStore over MemorryStore 用于增强网格
我在变量中定义了网格结构,
var templateGridStructure = [ {
name : "ID",
field : "id",
hidden : "true"
}, {
name : "Name",
field : "name",
width : "auto"
}, {
name : "Collection Method",
field : "_item",
width : "auto",
formatter : function(item) {
return item.collectorType.name;
}
}, {
name : "Export Method",
field : "_item",
width : "auto",
formatter : function(item) {
return item.exportType.name;
}
}, {
name : "Source File Type",
field : "_item",
width : "auto",
formatter : function(item) {
return item.fileType.name;
}
},{
name : "Duplication Check",
field : "checkDuplicate",
width : "auto",
},{
name : "Validation Check",
field : "checkValidate",
width : "auto",
},{
name : "Switch Type",
field : "_item",
width : "auto",
formatter : function(item) {
return item.switchType.name;
}
} ];
当我在 EnhancedGrid 中使用 ObjectStore 时
templateGrid = new dojox.grid.EnhancedGrid({
id : "templateGrid",
name : "templateGrid",
store : objectStore});
网格显示正确的数据但是当我在EnhancedGrid中使用JsonRestStore时
templateGrid = new dojox.grid.EnhancedGrid({
id : "templateGrid",
name : "templateGrid",
store : jsonRestStore});
我收到错误 - 网格不显示数据。
这两个存储之间定义列结构有什么区别。??
我发现错误,礼貌:Dojo IRC"Ravi:您不应该直接访问道场/数据存储的项目"而不是直接在格式化程序方法中使用项
{
name : "Switch Type",
field : "_item",
width : "auto",
formatter : function(item) {
return item.switchType.name;
}
}
使用 store.getValue(item,property),JsonRestStore,不允许直接访问项目
{
name : "Switch Type",
field : "_item",
width : "auto" ,
formatter : function(item) {
return store.getValue(item,"switchType").name;
}
}
我希望,有人会从中得到帮助