Skip to content

Commit 7977c7d

Browse files
almost def version of including dynamic buttonTitle
1 parent 52b63b0 commit 7977c7d

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

src/DropdownDivConverter/widget/DropdownDivConverter.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,16 @@ define([
6767
// mxui.widget._WidgetBase.update is called when context is changed or initialized. Implement to re-render and / or fetch data.
6868
update: function (obj, callback) {
6969
this._contextObj = obj;
70-
71-
this._resetSubscriptions();
72-
this._updateRendering(callback);
7370

7471
// preset the label
75-
this._buttonlabel = this.buttonTitle;
76-
if (this.dynamicButtonTitle != "") {
72+
this._buttonLabel = this.buttonTitle;
73+
if (this.dynamicButtonTitle !== "" && this._contextObj !== null) {
7774
this._dynamicLabel = true;
75+
this._buttonLabel = this._contextObj.get(this.dynamicButtonTitleAttribute);
7876
}
77+
78+
this._resetSubscriptions();
79+
this._updateRendering(callback);
7980
},
8081

8182
// Reordering the interface: selecting the siblings and putting them in the dropdown menu
@@ -92,7 +93,7 @@ define([
9293

9394
// Really render the interface, if renderAsOpen is true: render the menu in open state
9495
_renderInterface: function(renderAsOpen, callback) {
95-
this.dropdownButton.innerHTML = this.buttonTitle + "<span class='caret'></span>";
96+
this.dropdownButton.innerHTML = this._buttonLabel + "<span class='caret'></span>";
9697
// if a glyphicon icon was requested and the splitButton is not wanted: add the glyphicon to the button.
9798
if (this.buttonGlyphicon !== '' && !this.splitButtonActive){
9899
this._addGlyphicon(this.dropdownButton);
@@ -114,7 +115,6 @@ define([
114115
}
115116
}
116117
if (this.splitButtonActive) {
117-
console.log("createing split button call: "+ this._buttonLabel)
118118
this._createSplitButton();
119119
} else {
120120
domConstruct.destroy(this.splitButton);
@@ -279,7 +279,7 @@ define([
279279
_createSplitButton: function() {
280280
// create the new split button
281281
console.log("creating split button :" + this._buttonLabel);
282-
this.splitButton.innerHTML = this.buttonTitle;
282+
this.splitButton.innerHTML = this._buttonLabel;
283283
// if a glyphicon icon was requested: add the glyphicon to the button.
284284
if (this.buttonGlyphicon !== ''){
285285
this._addGlyphicon(this.splitButton);
@@ -289,6 +289,11 @@ define([
289289
// adjust the dropdownButtons content
290290
this.dropdownButton.innerHTML = "<span class='caret'></span><span class='sr-only'>Toggle Dropdown</span";
291291
},
292+
293+
// set the label of the button
294+
_setButtonLabel: function(){
295+
296+
},
292297

293298
// Add a glyphicon to a button
294299
_addGlyphicon: function(buttonObject) {

test/Test.mpr

0 Bytes
Binary file not shown.
5 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)