日期:2014-05-16 浏览次数:20398 次
项目中由于需要用到合并单元格、拆分等功能,用普通的table虽然可以满足要求,但是样式很难看,而且控制起来非常吃力,这几天在专门搞这个东西玩。
?
对于表头的数据,具体的部分数据由后台产生抛出,表示每个月的具体工作日工作周。
?
var columns = [ {name:"bigTitle",caption:reportData.bigTitle,children:[ {name:"orgName",caption:"组织结构名称",width:100,mode:"string"}, {name:"helpinfo",caption:reportData.columnCaption[0], children:[{name:"workday_month",caption:"工作日数",width:80,mode:"number",format:"#"}, {name:"loggedday_month",caption:"登录天数",width:80,mode:"number",format:"#"}] }, {name:"helpinfo",caption:reportData.columnCaption[1], children:[{name:"workday_week1",caption:"工作日数",width:70,mode:"number",format:"#"}, {name:"loggedday_week1",caption:"登录天数",width:70,mode:"number",format:"#"}] }, {name:"helpinfo",caption:reportData.columnCaption[2], children:[{name:"workday_week2",caption:"工作日数",width:70,mode:"number",format:"#"}, {name:"loggedday_week2",caption:"登录天数",width:70,mode:"number",format:"#"}] }, {name:"helpinfo",caption:reportData.columnCaption[3], children:[{name:"workday_week3",caption:"工作日数",width:70,mode:"number",format:"#"}, {name:"loggedday_week3",caption:"登录天数",width:70,mode:"number",format:"#"}] }, {name:"helpinfo",caption:reportData.columnCaption[4], children:[{name:"workday_week4",caption:"工作日数",width:70,mode:"number",format:"#"}, {name:"loggedday_week4",caption:"登录天数",width:70,mode:"number",format:"#"}] }, {name:"helpinfo",caption:reportData.columnCaption[5], children:[{name:"workday_week5",caption:"工作日数",width:70,mode:"number",format:"#"}, {name:"loggedday_week5",caption:"登录天数",width:70,mode:"number",format:"#"}] } ]} ];
?
这个用于控制删除没有数据的表头
for(n=5;n>=0;n--){ if(reportData.columnCaption[n]==null) columns[0]['children'].pop(); }
?
?
这个小组件还是非常好用的,支持json格式,支持ajax调用,支持一些简单的运算,支持jquery。
?
?