Commit 6fcb5e62 authored by GoshaZotov's avatar GoshaZotov Committed by Alexander.Trofimov

changes for update format table

parent cd93bfe2
...@@ -443,6 +443,9 @@ CHistory.prototype._addRedoObjectParam = function (oRedoObjectParam, Point) { ...@@ -443,6 +443,9 @@ CHistory.prototype._addRedoObjectParam = function (oRedoObjectParam, Point) {
oRedoObjectParam.oOnUpdateSheetViewSettings[Point.SheetId] = Point.SheetId; oRedoObjectParam.oOnUpdateSheetViewSettings[Point.SheetId] = Point.SheetId;
else if (AscCommonExcel.g_oUndoRedoWorksheet === Point.Class && (historyitem_Worksheet_RemoveRows === Point.Type || historyitem_Worksheet_RemoveCols === Point.Type || historyitem_Worksheet_AddRows === Point.Type || historyitem_Worksheet_AddCols === Point.Type)) else if (AscCommonExcel.g_oUndoRedoWorksheet === Point.Class && (historyitem_Worksheet_RemoveRows === Point.Type || historyitem_Worksheet_RemoveCols === Point.Type || historyitem_Worksheet_AddRows === Point.Type || historyitem_Worksheet_AddCols === Point.Type))
oRedoObjectParam.bAddRemoveRowCol = true; oRedoObjectParam.bAddRemoveRowCol = true;
else if(g_oUndoRedoAutoFilters === Point.Class && historyitem_AutoFilter_ChangeTableInfo === Point.Type)
oRedoObjectParam.oChangeWorksheetUpdate[Point.SheetId] = Point.SheetId;
}; };
CHistory.prototype.Get_RecalcData = function(Point2) CHistory.prototype.Get_RecalcData = function(Point2)
{ {
......
...@@ -4782,6 +4782,16 @@ TablePart.prototype.isShowButton = function() ...@@ -4782,6 +4782,16 @@ TablePart.prototype.isShowButton = function()
return res; return res;
}; };
TablePart.prototype.generateTotalsRowLabel = function()
{
if(!this.TableColumns)
{
return;
}
this.TableColumns[0].generateTotalsRowLabel();
};
/** @constructor */ /** @constructor */
function AutoFilter() { function AutoFilter() {
this.Ref = null; this.Ref = null;
...@@ -4983,6 +4993,14 @@ TableColumn.prototype.clone = function() { ...@@ -4983,6 +4993,14 @@ TableColumn.prototype.clone = function() {
res.CalculatedColumnFormula = this.CalculatedColumnFormula; res.CalculatedColumnFormula = this.CalculatedColumnFormula;
return res; return res;
}; };
TableColumn.prototype.generateTotalsRowLabel = function(){
//TODO добавить в перевод
if(this.TotalsRowLabel === null)
{
this.TotalsRowLabel = "Summary";
}
};
/** @constructor */ /** @constructor */
function TableStyleInfo() { function TableStyleInfo() {
this.Name = null; this.Name = null;
......
...@@ -2151,6 +2151,11 @@ ...@@ -2151,6 +2151,11 @@
tablePart.TotalsRowCount = tablePart.TotalsRowCount === null ? 1 : null; tablePart.TotalsRowCount = tablePart.TotalsRowCount === null ? 1 : null;
} }
if(val === true)
{
tablePart.generateTotalsRowLabel();
}
} }
break; break;
...@@ -3764,20 +3769,39 @@ ...@@ -3764,20 +3769,39 @@
if(style && style.Name && worksheet.workbook.TableStyles && worksheet.workbook.TableStyles.AllStyles && (styleForCurTable = worksheet.workbook.TableStyles.AllStyles[style.Name])) if(style && style.Name && worksheet.workbook.TableStyles && worksheet.workbook.TableStyles.AllStyles && (styleForCurTable = worksheet.workbook.TableStyles.AllStyles[style.Name]))
{ {
//заполняем названия столбцов //заполняем названия столбцов
if(true != isOpenFilter && headerRowCount > 0 && options.TableColumns) if(true != isOpenFilter && isSetVal && !bRedoChanges)
{ {
for(var ncol = bbox.c1; ncol <= bbox.c2; ncol++) if((headerRowCount > 0 || totalsRowCount > 0) && options.TableColumns)
{ {
var range = worksheet.getCell3(bbox.r1, ncol); for(var ncol = bbox.c1; ncol <= bbox.c2; ncol++)
var num = ncol - bbox.c1;
var tableColumn = options.TableColumns[num];
if(null != tableColumn && null != tableColumn.Name && !bRedoChanges && isSetVal)
{ {
range.setValue(tableColumn.Name); var range = worksheet.getCell3(bbox.r1, ncol);
range.setType(CellValueType.String); var num = ncol - bbox.c1;
var tableColumn = options.TableColumns[num];
if(null != tableColumn && null != tableColumn.Name && headerRowCount > 0)
{
range.setValue(tableColumn.Name);
range.setType(CellValueType.String);
}
if(tableColumn !== null && tableColumn.TotalsRowLabel !== null && totalsRowCount > 0)
{
range = worksheet.getCell3(bbox.r2, ncol);
range.setValue(tableColumn.TotalsRowLabel);
range.setType(CellValueType.String);
//TODO + далее необходимо добавлять формулу
}
} }
} }
else if(totalsRowCount)
{
//var range = worksheet.getCell3(bbox.r2, bbox.c1);
//range.setValue(tableColumn.Name);
//range.setType(CellValueType.String);
}
} }
//заполняем стили //заполняем стили
var aNoHiddenCol = []; var aNoHiddenCol = [];
for(var i = bbox.c1; i <= bbox.c2; i++) for(var i = bbox.c1; i <= bbox.c2; i++)
......
...@@ -10206,7 +10206,7 @@ ...@@ -10206,7 +10206,7 @@
return true; return true;
}; };
WorksheetView.prototype.changeWorksheet = function ( prop, val, displayNameFormatTable ) { WorksheetView.prototype.changeWorksheet = function ( prop, val ) {
// Проверка глобального лока // Проверка глобального лока
if ( this.collaborativeEditing.getGlobalLock() ) { if ( this.collaborativeEditing.getGlobalLock() ) {
return; return;
...@@ -10340,7 +10340,7 @@ ...@@ -10340,7 +10340,7 @@
functionModelAction = function () { functionModelAction = function () {
History.Create_NewPoint(); History.Create_NewPoint();
History.StartTransaction(); History.StartTransaction();
if ( range.addCellsShiftRight(displayNameFormatTable) ) { if ( range.addCellsShiftRight() ) {
fullRecalc = true; fullRecalc = true;
reinitRanges = true; reinitRanges = true;
t.cellCommentator.updateCommentsDependencies( true, val, arn ); t.cellCommentator.updateCommentsDependencies( true, val, arn );
...@@ -10361,7 +10361,7 @@ ...@@ -10361,7 +10361,7 @@
functionModelAction = function () { functionModelAction = function () {
History.Create_NewPoint(); History.Create_NewPoint();
History.StartTransaction(); History.StartTransaction();
if ( range.addCellsShiftBottom(displayNameFormatTable) ) { if ( range.addCellsShiftBottom() ) {
fullRecalc = true; fullRecalc = true;
reinitRanges = true; reinitRanges = true;
t.cellCommentator.updateCommentsDependencies( true, val, arn ); t.cellCommentator.updateCommentsDependencies( true, val, arn );
...@@ -12812,10 +12812,13 @@ ...@@ -12812,10 +12812,13 @@
var isChangeTableInfo = this.af_checkChangeTableInfo(tablePart, optionType); var isChangeTableInfo = this.af_checkChangeTableInfo(tablePart, optionType);
if(isChangeTableInfo !== false) if(isChangeTableInfo !== false)
{ {
History.Create_NewPoint();
History.StartTransaction();
this.model.autoFilters.changeFormatTableInfo(tableName, optionType, val); this.model.autoFilters.changeFormatTableInfo(tableName, optionType, val);
this._onUpdateFormatTable(isChangeTableInfo, false, true); this._onUpdateFormatTable(isChangeTableInfo, false, true);
//TODO добавить перерисовку таблицы и перерисовку шаблонов //TODO добавить перерисовку таблицы и перерисовку шаблонов
History.EndTransaction();
} }
}; };
...@@ -13037,7 +13040,11 @@ ...@@ -13037,7 +13040,11 @@
} }
//TODO тестовый вариант. нужно сделать методы и добавлять в историю //TODO тестовый вариант. нужно сделать методы и добавлять в историю
//ws.workbook.dependencyFormulas.changeDefName( tableName, newName );
var oldNamedrange = this.model.workbook.dependencyFormulas.getDefNameNodeByName(tablePart.DisplayName);
var newNamedrange = oldNamedrange.clone();
newNamedrange.Name = newName;
oldNamedrange.changeDefName(newNamedrange);
tablePart.DisplayName = newName; tablePart.DisplayName = newName;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment