Commit efca00de0f7fd2f84df9da2aa18206ad6da38344
1 parent
87dcaf01
Exists in
master
and in
102 other branches
Update tab name in current plot request if need
Showing
2 changed files
with
22 additions
and
1 deletions
Show diff stats
js/app/models/PlotTabNode.js
... | ... | @@ -147,7 +147,18 @@ Ext.define('amdaModel.PlotTabNode', { |
147 | 147 | }, |
148 | 148 | |
149 | 149 | rename: function(value,callBackFn) { |
150 | + var me = this; | |
150 | 151 | var dataToSend = {id : this.get('tabid'), old_name: this.modified.text, name: value, parent : this.data.parentId, leaf: this.isLeaf(), nodeType: this.get('nodeType')}; |
151 | - AmdaAction.renameObject(dataToSend, callBackFn); | |
152 | + AmdaAction.renameObject(dataToSend, function (result) { | |
153 | + callBackFn(result); | |
154 | + myDesktopApp.getLoadedModule(me.get('moduleId'), true, function (module) { | |
155 | + var uiContent = module.getUiContent(); | |
156 | + if (uiContent != null) { | |
157 | + if ((module.linkedNode != null) && (module.linkedNode.get('id') == dataToSend.parent)) { | |
158 | + uiContent.updatePlotTabName(dataToSend.id, dataToSend.name); | |
159 | + } | |
160 | + } | |
161 | + }); | |
162 | + }); | |
152 | 163 | }, |
153 | 164 | }); | ... | ... |
js/app/views/PlotUI.js
... | ... | @@ -186,6 +186,16 @@ Ext.define('amdaUI.PlotUI', { |
186 | 186 | } |
187 | 187 | }, |
188 | 188 | |
189 | + updatePlotTabName: function(tabId, name) { | |
190 | + var me = this; | |
191 | + this.object.tabs().each(function (tabObject) { | |
192 | + if (tabId == tabObject.getId()) { | |
193 | + tabObject.set('tab-name', name); | |
194 | + me.plotTabs.updatePlotTabs(); | |
195 | + } | |
196 | + }); | |
197 | + }, | |
198 | + | |
189 | 199 | insertPlotTab : function(tabData) { |
190 | 200 | var newTab = this.object.createNewTab(tabData); |
191 | 201 | this.plotTabs.addPlotTab(newTab,true); | ... | ... |