sheet=$this.spread_obj.getSheet(j);
var rows=result.data.jsonArrayResult[key].length+1;
var cloms=result.data.colNames.length;
var table = sheet.tables.add('raGinsSales', 1, 1,rows ,cloms );
//table.range();
var data = {};
data.ragins2 = result.data.jsonArrayResult[key]
window.data = data;
var names = result.data.colNames,
labels = result.data.colNames,
tableColumns = [];
//console.log(names);
table.autoGenerateColumns(false);
names.forEach(function (name, index) {
var tableColumn = new GC.Spread.Sheets.Tables.TableColumn();
tableColumn.name(labels[index]);
tableColumn.dataField(name);
tableColumns.push(tableColumn);
});
table.bindColumns(tableColumns);
table.bindingPath('ragins2');
table.style(undefined);
table.filterButtonVisible(false);
var source = new GC.Spread.Sheets.Bindings.CellBindingSource(data);
console.log(data);
sheet.setDataSource(source);
sheet.defaults.colWidth = 70;
sheet.setColumnWidth(0, 200); //设置单元格宽度
// sheet.addSpan(sel.row, sel.col, sel.rowCount, sel.colCount);
sheet.addSpan(0,0, 1, cloms+1);//合并单元格
var range = sheet.getRange(1, 1, rows, cloms);
range.setBorder(new GC.Spread.Sheets.LineBorder('black',
GC.Spread.Sheets.LineStyle.thin), { all: true });
sheet.repaint();
数据啥的都是后台读取的,会根据条件去后台重新提取数据,然后重新赋值不行 |