KendoUI 显示/隐藏 Grid 的列

Grid

<div data-role="grid"
     id="applyBillGridNew"
     data-resizable="true"
     data-columns="[
     { 'field': 'delete',title:'@ResourcesLan.Delete',width:50,'template':document.getElementById('Bill-Delete-tpl').innerHTML},
     {'field': 'DETAIL_ITEM_ID', 'width': 220 ,'title':'@ResourcesLan.Expenditure_Water_Number','template':document.getElementById('tpl_checkBillDetail').innerHTML  },
     { title:'支付方式' ,field:'Exp_ExpenseTypeName', width: 100 },
     { title:'业务员' ,field:'Exp_EmployeeName', width: 100 },
     { title:'部门' ,field:'Exp_DeptName' , width: 100},
     { title:'成本中心' ,field:'Exp_CompanyName' , width: 200},
     { title:'功能范围' ,field:'Exp_FuncAreaName' , width: 150},
     { title:'费用项目' ,field:'FYXMExp_ItemName', width: 100 },
     { title:'费用单元' ,field:'FTDYExp_CompanyName', width: 200 },
     { title:'费用大类' ,field:'Exp_ExpenseClassName' , width: 100},
     { title:'客户' ,field:'Exp_CustomerName', width: 200 },
     { title:'费用金额' ,field:'ExpenseAmount', width: 100  },
     { title:'产品组' ,field:'Exp_CpzName' , width: 100},
     { title:'内部订单' ,field:'Exp_Ktext', width: 200 },
     { title:'联络人' ,field:'Exp_Conno' , width: 100},
     { title:'委托人' ,field:'Exp_AgentName' , width: 100},
     { title:'备注' ,field:'Remark' , width: 200 },
    
         ]"
     data-bind="source: SelectedExpenseBillList">

隐藏指定的列

var grid = $("#applyBillGridNew").data("kendoGrid");
grid.hideColumn("Exp_EmployeeName");
grid.hideColumn("Exp_CompanyName");
grid.hideColumn("Exp_FuncAreaName");
grid.hideColumn("FYXMExp_ItemName");
grid.hideColumn("Exp_ExpenseClassName");
grid.hideColumn("Exp_CustomerName");
grid.hideColumn("Exp_DeptName");
grid.hideColumn("ExpenseAmount");
grid.hideColumn("Remark");
grid.hideColumn("Exp_Aufnr");
grid.hideColumn("Exp_Conno");
grid.hideColumn("Exp_AgentName");
grid.hideColumn("Exp_CpzName");
grid.hideColumn("Exp_Ktext");
grid.hideColumn("FTDYExp_CompanyName");

显示指定的列

var grid = $("#applyBillGridNew").data("kendoGrid");
grid.showColumn("Exp_EmployeeName");
grid.showColumn("Exp_CompanyName");
grid.showColumn("Exp_FuncAreaName");
grid.showColumn("FYXMExp_ItemName");
grid.showColumn("Exp_ExpenseClassName");
grid.showColumn("Exp_CustomerName");
grid.showColumn("ExpenseAmount");
grid.showColumn("Remark");
grid.showColumn("Exp_Aufnr");
grid.showColumn("Exp_Conno");
grid.showColumn("Exp_AgentName");
grid.showColumn("Exp_CpzName");
grid.showColumn("Exp_Ktext");

猜你喜欢

转载自blog.csdn.net/weixin_41392824/article/details/82255816