jqgrid的colModel里面的name,属性是否就是后台查出数据库表的列名
1个回答
推荐于2016-11-03 · 知道合伙人互联网行家
关注
展开全部
0
colModel中的name是列的名称 一个字段而已 而后台的sql是查询的一条记录中包含很多字段如:id ,name ....等
如果你要把一条记录在页面上显示 可以模仿这样写:
$("#grid1").xgrid({
url:{url:'../data/json-grid-standard.htm',pageSize:'10',currentPage:'1'},// 列表数据
colModel:[{"display":"序号","width":"20","align":"center","sortable":"false","name":"xuhao"},
{"display":"登陆ID","width":32,"align":"center","sortable":"true","name":"LOGIN_ID"},
{"display":"姓名","width":32,"align":"center","sortable":"true","name":"XM"},
{"display":"组织机构","width":32,"align":"left","sortable":"true","name":"ORG_ID"},
{"display":"区域","width":32,"align":"center","sortable":"true","name":"REGION_ID"},
{"display":"日期","width":32,"align":"center","sortable":"true","name":"DATE"},
{"display":"是否删除","width":32,"align":"center","sortable":"true","name":"ISDEL","hide":"true"}
], //列表结构配置
title:'列表控件',
searchitems:[
{"display":"登陆ID","name":"LOGIN_ID"},
{"display":"姓名","name":"XM"},
{"display":"时间","name":"ORG_ID"},
{"display":"日期","name":"DATE"},
{"display":"区域代码","name":"REGION_DM"}
],//列表中搜索的条件项
width:800,
callback:function(){ alert('列表初始化完成后,执行回调') },
searchMode:true //搜索模式,初始化时不加载数据并隐藏列表
});
colModel中的name是列的名称 一个字段而已 而后台的sql是查询的一条记录中包含很多字段如:id ,name ....等
如果你要把一条记录在页面上显示 可以模仿这样写:
$("#grid1").xgrid({
url:{url:'../data/json-grid-standard.htm',pageSize:'10',currentPage:'1'},// 列表数据
colModel:[{"display":"序号","width":"20","align":"center","sortable":"false","name":"xuhao"},
{"display":"登陆ID","width":32,"align":"center","sortable":"true","name":"LOGIN_ID"},
{"display":"姓名","width":32,"align":"center","sortable":"true","name":"XM"},
{"display":"组织机构","width":32,"align":"left","sortable":"true","name":"ORG_ID"},
{"display":"区域","width":32,"align":"center","sortable":"true","name":"REGION_ID"},
{"display":"日期","width":32,"align":"center","sortable":"true","name":"DATE"},
{"display":"是否删除","width":32,"align":"center","sortable":"true","name":"ISDEL","hide":"true"}
], //列表结构配置
title:'列表控件',
searchitems:[
{"display":"登陆ID","name":"LOGIN_ID"},
{"display":"姓名","name":"XM"},
{"display":"时间","name":"ORG_ID"},
{"display":"日期","name":"DATE"},
{"display":"区域代码","name":"REGION_DM"}
],//列表中搜索的条件项
width:800,
callback:function(){ alert('列表初始化完成后,执行回调') },
searchMode:true //搜索模式,初始化时不加载数据并隐藏列表
});
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询