EasyUI treegrid动态隐藏或显示列
以下是根据需求判断列展示还是隐藏
{ title: "举个栗子1", field: "Exampleone", width: 120, align: "center" },
{ title: "举个栗子2", field: "Exampletwo", width: 120, align: "center" },
{ title: "举个栗子3", field: "ExampleThree", width: 120, align: "center" },
if (条件) {
$('#gridTable').treegrid('hideColumn', 'Exampleone');
$('#gridTable').treegrid('hideColumn', 'Exampletwo');
$('#gridTable').treegrid('hideColumn', 'ExampleThree');
}
else {
$('#gridTable').treegrid('showColumn', 'Exampleone');
$('#gridTable').treegrid('showColumn', 'Exampletwo');
$('#gridTable').treegrid('showColumn', 'ExampleThree');
}
$('#gridTable').treegrid('loadData', { total: rs.records, rows: rs.rows };
当时在网上找了一些类似的方法,但是都没能实现,最终在EasyUI中找到了方法,分分钟就解决了。
建议大家当遇到问题,百度没出来,去官方文档看看,多测试一下。
这里贴下EasyUI的网址:Datagrid 数据网格
那里存在不足,也希望大佬们留下宝贵的建议,谢谢。