无为清净楼资源网 Design By www.qnjia.com
复制代码 代码如下:
$(function(){
$('#tt').datagrid({
title:'报表统计',
width:1020,
height:400,
url:'',
fitColumns:true,
loadMsg:'正在获取,请稍侯...',
singleSelect:true,
nowrap:false,
columns:[[
{field:'REGION_NAME',title:'分公司',width:30,align:'center'},
{field:'COUNTY_NAME',title:'区县',width:80,align:'center',editor:'text'},
{field:'AREA_NAME',title:'网格',width:80,align:'center',editor:'text'},
{field:'ORG_NAME',title:'网点',width:80,align:'center'},
{field:'TOTAL_NUM',title:'总业务量',width:40,align:'center'},
{field:'DH_NUM',title:'单宽业务量',width:40,align:'center'},
{field:'RH_NUM',title:'融合业务量',width:40,align:'center'},
{field:'YYT_NUM',title:'营业厅业务量',width:40,align:'center'},
{field:'QT_NUM',title:'其他业务量',width:40,align:'center'}
]],
toolbar:[
],
onDblClickRow: function() {
//selected = $('#tt').datagrid('getSelected');
//var index = $('#tt').datagrid('getRowIndex', selected);
//$('#tt').datagrid('beginEdit', index);
//progress();
//taskPreempte(selected.taskId);
}
});

$('#my_toolbar').appendTo('.datagrid-toolbar');

var dd = new Date();
var d1 = dd.getFullYear()+ "-" + (dd.getMonth()+1) + "-1" ;
var d2 = dd.getFullYear() + "-" + (dd.getMonth()+1) + "-" + dd.getDate() ;
$('#qryStartDate').datebox('setValue', d1); // set datebox value
$('#qryEndDate').datebox('setValue', d2); // set datebox value
refreshRpt2();

});

function refreshRpt2(){
var strStatCond = "b.region_name";
if($('#qryCon').attr("value")!=100){
param.sts = $('#qryCon').attr("value");
alert(param.sts);
}
param.qryBeginTime =$('#qryStartDate').datebox('getValue');
//alert(param.qryBeginTime);
param.qryEndTime = $('#qryEndDate').datebox('getValue');
//alert(param.qryEndTime);

if($('#region')!= null && $('#region').attr("checked") == true){

}
if($('#county')!= null && $('#county').attr("checked") == true){
strStatCond += ",c.county_name";
$('#tt').datagrid('showColumn', 'COUNTY_NAME');

}else{
$('#tt').datagrid('hideColumn', 'COUNTY_NAME');
}

if($('#area')!= null && $('#area').attr("checked") == true){
strStatCond += ",d.area_name";
$('#tt').datagrid('showColumn', 'AREA_NAME');
}else{
$('#tt').datagrid('hideColumn', 'AREA_NAME');
}
if($('#org')!= null && $('#org').attr("checked") == true){
strStatCond += ",e.org_name";
$('#tt').datagrid('showColumn', 'ORG_NAME');
}else{
$('#tt').datagrid('hideColumn', 'ORG_NAME');
}
alert(strStatCond);
param.statCond = strStatCond;
param.rptName = "statBusiRpt";
JSBaseCall.execute(param,showResult2);
}
//显示记录集
function showResult2(data){
var strJson=data["defaultJsonString"];
var result=eval('(' + strJson + ')');
//alert(strJson);
if (result.KEY_JSCALL_RESULT){
if (result.KEY_SERVICE_RES){//成功
totalRec=result.KEY_TOTAL_REC;
var d={"total":pageShowRec,
"rows":result.defaultAList
};
$('#tt').datagrid('loadData',d);
}
}
}

比如在“曲县”没数据时表格就不用显示空列了,而是直接将这一列隐藏掉
标签:
jQuery,显示和隐藏,datagrid中列

无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com