Add 'setWidget' action for plugin registration
Change-Id: I1ecdc14b7f906e2d3e15f3775af1dc98fd5bf2f8
diff --git a/dev/js/src/buttongroup.js b/dev/js/src/buttongroup.js
index e71d082..65ea860 100644
--- a/dev/js/src/buttongroup.js
+++ b/dev/js/src/buttongroup.js
@@ -59,9 +59,13 @@
b.classList.add.apply(b.classList, data['cls']);
};
- if (data['icon'] !== undefined){
+ if (data['icon'] !== undefined) {
b.setAttribute('data-icon', data['icon']);
};
+
+ if (data['state'] !== undefined) {
+ b['state'] = data['state'];
+ }
};
b.addE('span').addT(title);
@@ -102,6 +106,12 @@
* Add button that can toggle a state.
* The state has to be a state object.
*/
+ /*
+ * TODO:
+ * Do not add a state object here, but embed the
+ * state in the data and "roll()" through the different
+ * state options instead.
+ */
addToggle : function (title, data, state) {
let b = this._element.addE('span');
b.setAttribute('title',title);