- 注册时间
- 2013-3-11
- 最后登录
- 2015-4-19
- 阅读权限
- 10
- 积分
- 194
- 精华
- 0
- 帖子
- 38
|
本帖最后由 XTX827227881 于 2013-4-15 11:21 编辑
后台返回Json:
{"columns":[{"field":"ID","header":"ID"},{"field":"StudentID","header":"学籍号"},{"field":"StudentName","header":"学生姓名"},{"field":"StudentSex","header":"性别"},{"field":"StudentCategory","header":"生源性质"},{"field":"ChargeItem0","header":"学费(调招生免280补60)"},{"field":"ChargeItem1","header":"住宿费(大寝室300小寝室200)"},{"field":"ChargeItem2","header":"作业本费"},{"field":"ChargeItem3","header":"课本预收款"},{"field":"ChargeItem13","header":"代收新华书店资料费"},{"field":"ChargeItem14","header":"军训费"},{"field":"ChargeItem15","header":"互助金"}],"Message":"获取学生收费信息成功!","State":0}
前台代码处理Json:
//动态添加列
function createColumns(columns){
var txt = '[{type:"checkcolumn"},' +
'{type:"indexcolumn", headeralign:"center", width:"30", header:"序号"}';
for(var index = 0, count = columns.length;index < count;index ++){
txt += ',{field:"'+columns[index].field + '", headeralign:"center", width:"50", header:"' + columns[index].header + '"}';
}
txt += "]";
DataGrid.set({columns:mini.decode(txt)});
DataGrid.render(document.body);
//隐藏掉ID列
var id_column = DataGrid.getColumn("ID");
DataGrid.hideColumn(id_column);
}
问题:能够动态的生成列了,但是 var id_column = DataGrid.getColumn("ID");DataGrid.hideColumn(id_column);调试这句不能够隐藏此列?原因是什么?
显示界面为:
|
|