Smartbi报表宏api

显示:

simpleReportGrid

继承 BaseGrid

即席查询的表格对象

方法

getCell

(
  • row
  • col
)
HTML

获取单元格对象

参数:

  • row int

    行坐标

  • col int

    列坐标

返回值:

HTML:

单元格对象所在的HTML DOM元素

getFieldByColNum

(
  • colNum
)
Object

获取表头单元格对象

参数:

  • colNum int

    列坐标

返回值:

Object:

表头单元格对象

示例:

function main(simpleReport, simpleReportContext) {
    //获取下标为2的表头单元格对象
    var obj = simpleReport.grid.getFieldByColNum(2);
    console.log(obj);
}
//表头单元格对象
输出:
{
    aggregateMethod: "NULL"
    alias: "销售量"
    businessViewField: {orderbyLevel: -1, desc: "", id: "BizViewOutField.I8a8a9f...", transformRule: "", name: "销售量", …}
    cacheIdentity: "BIZATTR.northwind.订单主题.销售量销售量<整型-默认值>NULL"
    dataFormat: "<整型-默认值>"
    dataType: "INTEGER"
    desc: ""
    format: ""
    id: "BizViewOutField.I8a8a9f..."
    maskingRule: ""
    name: "销售量"
    refId: "BIZATTR.northwind.订单主题.销售量"
    table: {fields: Array(3), desc: "", id: "I8a8a9f...", name: "", alias: ""}
    tempId: "F76"
    transformRule: ""
}

getGridData

() Array

继承自 BaseGrid:

获取表格数据的二维数组

返回值:

Array: 表格数据的二维数组

示例:

function main(simpleReport, simpleReportContext) {
    //获取表格所有行的数据
    var obj = simpleReport.grid.getGridData();
    console.log(obj);
}

输出:
[["沙茶", "167.40", "9"], ["猪肉干", "1,696.00", "40"], ["虾子", "77.00", "10"]]

getHeaderRows

() int

获取表头行数

返回值:

int:

表头行数

getRowCount

() int

继承自 BaseGrid:

获取表格行数

返回值:

int: 行数