function main(olapQuery) {
var rowHead = "2016年"; //设置需要标记的行头
var columnHead = "销售量"; //设置需要标记的列
signData(olapQuery, rowHead, columnHead);
}
//标注指定行和列的数据
function signData(olapQuery, rowHead, columnHead) {
var grid = olapQuery.domAgent.getElementByBofid("olap-grid"); //获取表格对象,该表格是html里面的<table>对象。
var row = grid.rows[0];
while (row) {
var cell = row.firstChild; //获取列
while (cell) {
// 行头的判断
if (cell.innerHTML.indexOf(rowHead) != -1) { //列标记
cell.style.color = "red";
}
// 列头的判断
if (cell.innerHTML.indexOf(columnHead) != -1 && cell.firstChild && cell.firstChild.tagName == "TABLE") {
//cell.firstChild.style.color = "red";
cell.firstChild.firstChild.firstChild.firstChild.style.color = "red";
}
cell = cell.nextSibling;
}
row = row.nextSibling;
}
}