handsontable 给单元格自定义属性
1 setHotAttr(hotObj,rowHeader,colHeader){// 给handsongtable绑定行列属性 2 console.log(hotObj); 3 console.log(colHeader); 4 console.log(rowHeader); 5 6 let count_col = Number(hotObj.countCols());//获取列数 7 let count_row = Number(hotObj.countRows());//获取行数 8 9 for (let i=0;i<count_row;i++){ 10 for (let j=0;j<count_col;j++){ 11 hotObj.setCellMeta(i,j,'rowId',rowHeader[i]); 12 hotObj.setCellMeta(i,j,'colId',colHeader[j]); 13 // console.log(hotObj.getCellMeta(i,j)['rowId']); 14 // console.log(hotObj.getCellMeta(i,j)['colId']); 15 } 16 } 17 } 18 19 self.setHotAttr(htobj.HtObj,self.testData[i].hotSettings.rowHeaders,self.testData[i].hotSettings.colHeaders);