|
@@ -86,3 +86,54 @@ let MainTreeCol = {
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
+
|
|
|
+let colSettingObj = {
|
|
|
+ settingSpread: null,
|
|
|
+ checkBox: new GC.Spread.Sheets.CellTypes.CheckBox(),
|
|
|
+ loadSetting: function (sheet, setting) {
|
|
|
+ sheet.setColumnCount(setting.cols.length);
|
|
|
+ sheet.setRowCount(setting.headRows, GC.Spread.Sheets.SheetArea.colHeader);
|
|
|
+ sheet.setRowCount(1);
|
|
|
+ sheet.getRange(0, -1, 1, -1).cellType(this.checkBox).hAlign(GC.Spread.Sheets.HorizontalAlign.center);
|
|
|
+
|
|
|
+ setting.headRowHeight.forEach(function (rowHeight, index) {
|
|
|
+ sheet.setRowHeight(index, rowHeight, GC.Spread.Sheets.SheetArea.colHeader);
|
|
|
+ });
|
|
|
+ setting.cols.forEach(function (col, index) {
|
|
|
+ let i, iRow = 0, cell;
|
|
|
+ for (i = 0; i < col.head.spanCols.length; i++) {
|
|
|
+ if (col.head.spanCols[i] !== 0) {
|
|
|
+ cell = sheet.getCell(iRow, index, GC.Spread.Sheets.SheetArea.colHeader);
|
|
|
+ cell.value(col.head.titleNames[i]).font(col.head.font).hAlign(col.head.hAlign[i]).vAlign(col.head.vAlign[i]).wordWrap(true);
|
|
|
+ }
|
|
|
+ if (col.head.spanCols[i] > 1 || col.head.spanRows[i] > 1) {
|
|
|
+ sheet.addSpan(iRow, index, col.head.spanRows[i], col.head.spanCols[i], GC.Spread.Sheets.SheetArea.colHeader);
|
|
|
+ }
|
|
|
+ iRow += col.head.spanRows[i];
|
|
|
+ };
|
|
|
+ sheet.setColumnWidth(index, col.width);
|
|
|
+ cell = sheet.getCell(0, index).value(col.visible);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ initSettingSpread: function () {
|
|
|
+ this.settingSpread = SheetDataHelper.createNewSpread($('#col_setting_spread')[0], {sheetCount: 1});
|
|
|
+ this.settingSpread.options.showScrollTip = GC.Spread.Sheets.ShowScrollTip.horizontal;
|
|
|
+ this.loadSetting(this.settingSpread.getActiveSheet(), projectObj.project.projSetting.main_tree_col);
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+$('#column').on('shown.bs.modal', function () {
|
|
|
+ if (!colSettingObj.settingSpread) {
|
|
|
+ colSettingObj.initSettingSpread();
|
|
|
+ }
|
|
|
+});
|
|
|
+
|
|
|
+$('#column').on('hide.bs.modal', function () {
|
|
|
+ let sheet = colSettingObj.settingSpread.getActiveSheet();
|
|
|
+ for (let iCol = 0; iCol < sheet.getColumnCount(); iCol ++) {
|
|
|
+ projectObj.project.projSetting.main_tree_col.cols[iCol].visible = sheet.getValue(0, iCol);
|
|
|
+ projectObj.project.projSetting.mainGridSetting.cols[iCol].visible = sheet.getValue(0, iCol);
|
|
|
+ }
|
|
|
+ SheetDataHelper.refreshColumnVisible(projectObj.project.projSetting.mainGridSetting, projectObj.mainSpread.getActiveSheet());
|
|
|
+ projectObj.project.pushNow('editColSetting', projectObj.project.projSetting.moduleName, {projectID: projectObj.project.ID(), main_tree_col: projectObj.project.projSetting.main_tree_col});
|
|
|
+})
|