使用kendui的grid插件生成表格,需要使用
loadFilds : function() {
var fields = {
id : {
type : "String"
},
customsCode : {
type : "String"
},
customsName : {
type : "String"
},
parentCusCode : {
type : "String"
},
longitude : {
type : "Double"
},
latitude : {
type : "Double"
},
comment : {
type : "String"
},
level : {
type : "Integer"
},
createUser : {
type : "String"
},
createTime : {
type : "Timestamp"
},
updateUser : {
type : "String"
},
updateTime : {
type : "Timestamp"
}
};
},
/*
* 加载list 列表
*/
gridColumns : function() {
return [
{
width : 40,
template : '<input type="checkbox" value="${id}"/>',
headerTemplate : '<input type="checkbox" value="head" />'
},
{
title : "idLabel",
field : "id",
hidden : false
// hidden:true
},
{
title : "eqCodeLabel",
field : "eqCode"
// hidden:false
},
{
title : "typeLabel",
field : "type",
// hidden:true
},
{
title : "sim1Label",
field : "sim1"
},
{
title : "sim2Label",
field : "sim2"
},
{
title : "createUserIdLabel",
field : "createUserId"
},
{
title : "createTimeLabel",
field : "createTime"
},
{
title : "updateUserIdLabel",
field : "updateUserId",
//hidden : true
},
{
title : "updateTimeLabel",
field : "updateTime",
//template : '#= timeStamp2String(createTime)#',
hidden : false
},
{
title : "isUseStateLabel",
field : "isUseState",
hidden : true
},
{
title : "commentLabel",
field : "comment",
hidden : true
}, {
title : "licenseLabel",
field : "license",
//template : '#= timeStamp2String(updateTime)#',
hidden : false
},
{
command : {
text : t("eq.editBtn"),
click : this.edit
},
title : "editBtn ",
width : "80px",
headerTemplate : t("eq.editBtn")
},
{
command : {
text : t("eq.delBtn"),
click : this.del
},
title : "delBtn",
width : "80px",
headerTemplate : t("eq.delBtn")
} ];
},
这里对应的field看似是对应的pojo类中的属性名,但是其实是对应的返回的数据的转成json之后的属性名,
区别在于:1、当pojo类中的属性名首字母大写时,json串中的field会自动改为小写;
2、当pojo类中的属性值所有字母都为大写时,json串中field也是大写的,这个没有关系,
3、当pojo类中的属性值首字母小写,使用驼峰法定义时,json串中field与属性值是一致的,也没有关系
这个时候,上述三种情况中,当出现第一种情况时,以上代码中field应该保持与json串中的field一致,而当与属性名一致时,会出现列表中该字段对应的数据不显示的情况