<%@ page contentType="text/html; charset=UTF-8"%>
<!-- 选择要导出列的Dialog -->
<div id="selectColumnDialog" style="display:none" >
<div id="selectColumnBox" height="200px" class="gridbox"></div>
</div>
<script>
var columnGrid;
var statisticsGridCols = new GridUtil.colFactory([
['列名' , 'columnName' , false, 25 , 'ed'],
['列名ID' , 'columnID' , false, 0 , 'ro'],
['是否显示' , 'showOrHide' , false, 20 , 'ch'],
['宽度' , 'columnWidth' , false, 20 , 'edn'],
['列编辑类型' , 'columnEditTpe' , false, 0 , 'ro'],
['列颜色' , 'columnColor' , false, 0 , 'ro'],
['列对齐' , 'columnAligns' , false, 0 , 'ro'],
['列字段类型' , 'columnType' , false, '*' , 'ro'],
['合计' , 'columnTotal' , false, 15 , 'ch'],
]);
var statisticspc = statisticsGridCols.getColIndex();
//响应导出Excel的操作
function doExportExcel()
{
//初始化页面时添加5个隐藏字段
if(!columnGrid){
jQuery("#queryform").append("<input type='hidden' name='columnNameLs' value='' />");
jQuery("#queryform").append("<input type='hidden' name='columnIDLs' value='' />");
jQuery("#queryform").append("<input type='hidden' name='columnWidthLs' value='' />");
jQuery("#queryform").append("<input type='hidden' name='columnTypeLs' value='' />");
jQuery("#queryform").append("<input type='hidden' name='columnTotalLs' value='' />");
}
var height = data.length * 24.0 > 500 ? data.length * 24.0 : 500;
jQuery("#selectColumnBox").empty();
columnGrid = new dhtmlXGridObject('selectColumnBox');
columnGrid.setImagePath('/html/js/dhtmlxgrid/imgs/');
statisticsGridCols.setGridColumns(columnGrid);
columnGrid.enableAutoHeight(true,"250px",false);
columnGrid.init();
columnGrid.parse(data, hideColumnAndRow, "jsarray");
jQuery("#selectColumnDialog").show().dialog(
{
title : '请设置各导出参数',
height : height,
width : 600,
resizable : false,
modal : true,
draggable : false,
buttons :{
'确定': confirmExport,
'取消': closeSelectColumnDialog
},
close : function() {
jQuery(":button").attr("disabled","");
gridReset();
}
});
}
//隐藏不显示的行和列
function hideColumnAndRow(){
//隐藏不显示的列
columnGrid.setColumnHidden(statisticspc.columnID ,true);
columnGrid.setColumnHidden(statisticspc.columnEditTpe ,true);
columnGrid.setColumnHidden(statisticspc.columnAligns ,true);
columnGrid.setColumnHidden(statisticspc.columnColor ,true);
//隐藏不显示的行
var rownum = columnGrid.rowsCol.length;
for(var i=0; i<rownum; i++){
var id = columnGrid.getRowId(i);
var showOrHide = columnGrid.cells(id, statisticspc.showOrHide).getValue();
var columnType = columnGrid.cells(id, statisticspc.columnType).getValue();
var columnID = columnGrid.cells(id, statisticspc.columnID).getValue();
if(showOrHide == '${Globals.YES}'){
columnGrid.deleteRow(id);
i--;
rownum--;
}
else {
if(columnType == 'int'){
columnGrid.cells(id, statisticspc.columnTotal).setValue(columnID);
}
else{
var cell = columnGrid.cells(id, statisticspc.columnTotal)
columnGrid.setCellExcellType(id,cell,'ro');
}
columnGrid.cells(id, statisticspc.showOrHide).setValue('${Globals.YES}');
}
}
}
//相应确定按钮事件
function confirmExport(){
if(window.confirm("<liferay-ui:message key='contractstat.waitforexport' />")){
var rowIds = columnGrid.getCheckedRows(statisticspc.showOrHide);
var columnNameLs = columnGrid.getColumnsValue(statisticspc.columnName ,rowIds);
var columnIDLs = columnGrid.getColumnsValue(statisticspc.columnID ,rowIds);
var columnWidthLs = columnGrid.getColumnsValue(statisticspc.columnWidth ,rowIds);
var columnTypeLs = columnGrid.getColumnsValue(statisticspc.columnType ,rowIds);
var columnTotalLs = columnGrid.getColumnsValue(statisticspc.columnTotal ,rowIds);
setDomValue("columnNameLs" ,columnNameLs );
setDomValue("columnIDLs" ,columnIDLs );
setDomValue("columnWidthLs" ,columnWidthLs );
setDomValue("columnTypeLs" ,columnTypeLs );
setDomValue("columnTotalLs" ,columnTotalLs );
var params = new Query('queryform').getQueryJson('export');
postForm(exportURL, params);
}
else
{
closeSelectColumnDialog();
}
}
//相应取消按钮事件
function closeSelectColumnDialog(){
jQuery("#selectColumnDialog").dialog( 'close' );
}
</script>
<!-- 选择要导出列的Dialog -->
<div id="selectColumnDialog" style="display:none" >
<div id="selectColumnBox" height="200px" class="gridbox"></div>
</div>
<script>
var columnGrid;
var statisticsGridCols = new GridUtil.colFactory([
['列名' , 'columnName' , false, 25 , 'ed'],
['列名ID' , 'columnID' , false, 0 , 'ro'],
['是否显示' , 'showOrHide' , false, 20 , 'ch'],
['宽度' , 'columnWidth' , false, 20 , 'edn'],
['列编辑类型' , 'columnEditTpe' , false, 0 , 'ro'],
['列颜色' , 'columnColor' , false, 0 , 'ro'],
['列对齐' , 'columnAligns' , false, 0 , 'ro'],
['列字段类型' , 'columnType' , false, '*' , 'ro'],
['合计' , 'columnTotal' , false, 15 , 'ch'],
]);
var statisticspc = statisticsGridCols.getColIndex();
//响应导出Excel的操作
function doExportExcel()
{
//初始化页面时添加5个隐藏字段
if(!columnGrid){
jQuery("#queryform").append("<input type='hidden' name='columnNameLs' value='' />");
jQuery("#queryform").append("<input type='hidden' name='columnIDLs' value='' />");
jQuery("#queryform").append("<input type='hidden' name='columnWidthLs' value='' />");
jQuery("#queryform").append("<input type='hidden' name='columnTypeLs' value='' />");
jQuery("#queryform").append("<input type='hidden' name='columnTotalLs' value='' />");
}
var height = data.length * 24.0 > 500 ? data.length * 24.0 : 500;
jQuery("#selectColumnBox").empty();
columnGrid = new dhtmlXGridObject('selectColumnBox');
columnGrid.setImagePath('/html/js/dhtmlxgrid/imgs/');
statisticsGridCols.setGridColumns(columnGrid);
columnGrid.enableAutoHeight(true,"250px",false);
columnGrid.init();
columnGrid.parse(data, hideColumnAndRow, "jsarray");
jQuery("#selectColumnDialog").show().dialog(
{
title : '请设置各导出参数',
height : height,
width : 600,
resizable : false,
modal : true,
draggable : false,
buttons :{
'确定': confirmExport,
'取消': closeSelectColumnDialog
},
close : function() {
jQuery(":button").attr("disabled","");
gridReset();
}
});
}
//隐藏不显示的行和列
function hideColumnAndRow(){
//隐藏不显示的列
columnGrid.setColumnHidden(statisticspc.columnID ,true);
columnGrid.setColumnHidden(statisticspc.columnEditTpe ,true);
columnGrid.setColumnHidden(statisticspc.columnAligns ,true);
columnGrid.setColumnHidden(statisticspc.columnColor ,true);
//隐藏不显示的行
var rownum = columnGrid.rowsCol.length;
for(var i=0; i<rownum; i++){
var id = columnGrid.getRowId(i);
var showOrHide = columnGrid.cells(id, statisticspc.showOrHide).getValue();
var columnType = columnGrid.cells(id, statisticspc.columnType).getValue();
var columnID = columnGrid.cells(id, statisticspc.columnID).getValue();
if(showOrHide == '${Globals.YES}'){
columnGrid.deleteRow(id);
i--;
rownum--;
}
else {
if(columnType == 'int'){
columnGrid.cells(id, statisticspc.columnTotal).setValue(columnID);
}
else{
var cell = columnGrid.cells(id, statisticspc.columnTotal)
columnGrid.setCellExcellType(id,cell,'ro');
}
columnGrid.cells(id, statisticspc.showOrHide).setValue('${Globals.YES}');
}
}
}
//相应确定按钮事件
function confirmExport(){
if(window.confirm("<liferay-ui:message key='contractstat.waitforexport' />")){
var rowIds = columnGrid.getCheckedRows(statisticspc.showOrHide);
var columnNameLs = columnGrid.getColumnsValue(statisticspc.columnName ,rowIds);
var columnIDLs = columnGrid.getColumnsValue(statisticspc.columnID ,rowIds);
var columnWidthLs = columnGrid.getColumnsValue(statisticspc.columnWidth ,rowIds);
var columnTypeLs = columnGrid.getColumnsValue(statisticspc.columnType ,rowIds);
var columnTotalLs = columnGrid.getColumnsValue(statisticspc.columnTotal ,rowIds);
setDomValue("columnNameLs" ,columnNameLs );
setDomValue("columnIDLs" ,columnIDLs );
setDomValue("columnWidthLs" ,columnWidthLs );
setDomValue("columnTypeLs" ,columnTypeLs );
setDomValue("columnTotalLs" ,columnTotalLs );
var params = new Query('queryform').getQueryJson('export');
postForm(exportURL, params);
}
else
{
closeSelectColumnDialog();
}
}
//相应取消按钮事件
function closeSelectColumnDialog(){
jQuery("#selectColumnDialog").dialog( 'close' );
}
</script>