function main(spreadsheetReport) {
addButtons(spreadsheetReport);
}
//新增按钮
function addButtons(spreadsheetReport) {
//获取电子表格参数面板,后面要将按钮添加在参数面板之后
var lastCell = spreadsheetReport.paramPanelObj;
var paramTable = spreadsheetReport.paramPanelObj.layoutTable;
var i, cell, lastCell;
for (i = 0; i < paramTable.rows.length; i++) {
cell = paramTable.rows[i].insertCell(-1);
var tr = paramTable.rows[i];
if (i == paramTable.rows.length - 1) {
for (j = tr.cells.length - 1; j >= 0; j--) {
var td = tr.cells[j];
if (td.innerHTML == "") {
lastCell = td;
} else {
break;
}
}
}
}
if (!spreadsheetReport._newBtn) {
//添加查询按钮
var saveButton = document.createElement("button");
saveButton.type = "button";
saveButton.innerText = "查询";
saveButton.title = "查询";
saveButton.className = "queryview-toolbar-button";
saveButton.style.background = "url(img/querygrid/refresh.png) no-repeat left center";
saveButton.style.width = "65px";
saveButton.style.height = "20px";
var newBtn = lastCell.appendChild(saveButton);
//添加点击事件
spreadsheetReport.addListener(saveButton, "click", function() {
spreadsheetReport.doRefresh(true);
}, spreadsheetReport);
spreadsheetReport._newBtn = newBtn;
//添加导出按钮
var exportBtn = document.createElement("button");
exportBtn.innerText = " 导出 ";
exportBtn.title = " 导出 ";
exportBtn.className = "queryview-toolbar-button";
exportBtn.style.width = "65px";
exportBtn.style.height = "20px";
exportBtn.style.marginLeft = "3px";
exportBtn.style.background = "url(img/querygrid/edit_excel.png) no-repeat left center";
//添加点击事件
var newBtn1 = lastCell.appendChild(exportBtn);
spreadsheetReport.addListener(exportBtn, "click", function() {
spreadsheetReport.doExportMenuCloseUp("EXCEL2007");
}, spreadsheetReport);
spreadsheetReport._newBtn = newBtn1;
}
}