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

add function changeTableRef(defNames)

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