首页 > 代码库 > treegrid 动态隐藏列
treegrid 动态隐藏列
function getShorMonths(){
var d = new Date();
var str = d.getFullYear()+"-"+(d.getMonth()+1);
var arr=["2018-12","2018-11","2018-10","2018-09","2018-08","2018-07","2018-06","2018-05","2018-04","2018-03","2018-02","2018-01","2017-12","2017-11","2017-10","2017-09","2017-08","2017-07","2017-06","2017-05","2017-04","2017-03","2017-02","2017-01","2016-12","2016-11","2016-10","2016-09","2016-08","2016-07","2016-06","201-605","2016-04","2016-03","2016-02","2016-01"];
$.each(arr,function (index,d){
var stdt=new Date(str);
var etdt=new Date(d);
if(etdt>stdt){
var h="p"+d.replace("-","");
$(‘#dw‘).treegrid(‘hideColumn‘, h);
}
});
}
treegrid 动态隐藏列