当遇到表头字段比较多,而数据项比较少的时候,横向显示有时候不方便
需要竖着显示。
可以如下展示
function daydetailmethod(id){
var rows = [];
$.ajax({
url:path+"/xxxx/xxxxx?id="+id,
type:"post",
dataType:"json",
async:false,
success:function(data){
rows =[
{ "name": "day1", "group": "帐号", "value": ""+data.rows[0].colun1+"", "editor": "" },
{ "name": "day2", "group": "帐号", "value": ""+data.rows[0].colum2+"", "editor": "" }
];
}
})
$("#name").propertygrid({
showGroup:false,
fit:true,//自动补全
columns: [[
{ field: 'name', title: '天数', width: 100, resizable: true },
{ field: 'value', title: '人数', width: 100, resizable: false }
]],
onLoadSuccess: function (data) {
$("#daydetail").window('open');
},
onLoadError:function(data){
alert("查询失败");
}
})
$('#name').propertygrid('loadData', rows);
}
这里面需要注意一下,ajax 的同步异步,
editor 属性是编辑, text 具体可参考easyui