Commit 7bea6f90 authored by GoshaZotov's avatar GoshaZotov Committed by Alexander.Trofimov

add function changeTableRef(defNames)

parent fa9b68e7
...@@ -1152,6 +1152,34 @@ DependencyGraph.prototype = { ...@@ -1152,6 +1152,34 @@ DependencyGraph.prototype = {
table.Ref = table.Ref.split("!")[0]+"!"+newRefClone.getAbsName(); table.Ref = table.Ref.split("!")[0]+"!"+newRefClone.getAbsName();
table.rebuild(); table.rebuild();
// table.Ref = parserHelp.getEscapeSheetName(ws.getName())+"!"+newRef.getAbsName(); // table.Ref = parserHelp.getEscapeSheetName(ws.getName())+"!"+newRef.getAbsName();
},
changeTableRef:function(tableName, ws, newName){
var table = this.getDefNameNodeByName( tableName, ws );
var newTable = table.clone();
if(table)
{
//изменяем имя именнованного диапазона
newTable.Name = newName;
newTable.cellId = newName.toLowerCase();
newTable.nodeId = table.sheetId + table.cellId;
this.changeDefName(table, newTable);
//изменяем все ссылки на данную таблицу
var nameRef = tableName + "[]";
for(var i in this.defNameList)
{
if(this.defNameList[i] && this.defNameList[i].Ref && this.defNameList[i].Ref === nameRef)
{
this.defNameList[i].Ref = newName + "[]";
}
}
}
table.rebuild();
}, },
delTableName:function(name,ws){ delTableName:function(name,ws){
var table = this.getDefNameNodeByName( name, ws ); var table = this.getDefNameNodeByName( name, ws );
......
...@@ -2269,10 +2269,7 @@ ...@@ -2269,10 +2269,7 @@
History.StartTransaction(); History.StartTransaction();
//TODO добавлять в историю смену именного диапазона //TODO добавлять в историю смену именного диапазона
var oldNamedrange = worksheet.workbook.dependencyFormulas.getDefNameNodeByName(tablePart.DisplayName); worksheet.workbook.dependencyFormulas.changeTableRef(tableName, worksheet, newName);
var newNamedrange = oldNamedrange.clone();
newNamedrange.Name = newName;
oldNamedrange.changeDefName(newNamedrange);
tablePart.changeDisplayName(newName); tablePart.changeDisplayName(newName);
......
...@@ -2813,10 +2813,12 @@ ...@@ -2813,10 +2813,12 @@
color = null; color = null;
if(styleOptions.totalRow && styleOptions.totalRow.dxf.fill && null != styleOptions.totalRow.dxf.fill.bg) if(styleOptions.totalRow && styleOptions.totalRow.dxf.fill && null != styleOptions.totalRow.dxf.fill.bg)
color = styleOptions.totalRow.dxf.fill.bg; color = styleOptions.totalRow.dxf.fill.bg;
else
color = defaultColorBackground; if(color !== null)
ctx.setFillStyle(color); {
ctx.fillRect(0, stepY*4, xSize, stepY); ctx.setFillStyle(color);
ctx.fillRect(0, stepY * 4, xSize, stepY);
}
} }
......
...@@ -12813,8 +12813,12 @@ ...@@ -12813,8 +12813,12 @@
var isChangeTableInfo = this.af_checkChangeTableInfo(tablePart, optionType); var isChangeTableInfo = this.af_checkChangeTableInfo(tablePart, optionType);
if(isChangeTableInfo !== false) if(isChangeTableInfo !== false)
{ {
var callback = function() var callback = function(isSuccess)
{ {
if ( false === isSuccess ) {
return;
}
History.Create_NewPoint(); History.Create_NewPoint();
History.StartTransaction(); History.StartTransaction();
t.model.autoFilters.changeFormatTableInfo(tableName, optionType, val); t.model.autoFilters.changeFormatTableInfo(tableName, optionType, val);
...@@ -12971,7 +12975,11 @@ ...@@ -12971,7 +12975,11 @@
return; return;
} }
var callback = function () { var callback = function (isSuccess) {
if ( false === isSuccess ) {
return;
}
History.Create_NewPoint(); History.Create_NewPoint();
History.StartTransaction(); History.StartTransaction();
...@@ -13171,15 +13179,25 @@ ...@@ -13171,15 +13179,25 @@
WorksheetView.prototype.af_changeTableRange = function(tableName, range) WorksheetView.prototype.af_changeTableRange = function(tableName, range)
{ {
History.Create_NewPoint(); var t = this;
History.StartTransaction();
range = Asc.g_oRangeCache.getAscRange(range); range = Asc.g_oRangeCache.getAscRange(range);
this.model.autoFilters.changeTableRange(tableName, range);
this._onUpdateFormatTable(range, false, true); var callback = function (isSuccess) {
//TODO добавить перерисовку таблицы и перерисовку шаблонов if ( false === isSuccess ) {
History.EndTransaction(); return;
}
History.Create_NewPoint();
History.StartTransaction();
t.model.autoFilters.changeTableRange(tableName, range);
t._onUpdateFormatTable(range, false, true);
//TODO добавить перерисовку таблицы и перерисовку шаблонов
History.EndTransaction();
};
t._isLockedCells( range, null, callback );
}; };
WorksheetView.prototype.af_checkChangeRange = function(range) WorksheetView.prototype.af_checkChangeRange = function(range)
......
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