Widget does not perform subscribe to an attribute

3
Dear forum users, I am currently having a problem performing a subscribe to an attribute. I have made an style object for the CKEditorForMendix widget to add CSS styling to the editor. It works fine to add the style to the editor. Now I am having the problem that I want the style to change when the user changes the associated style via a dropdown. When I perform a subscribe to the whole object or the CSS Style attribute it does not respond. This is the code I added to the _resetSubscriptions function: if (this._styleObj) { this.subscribe({ guid: this._styleObj.getGuid(), callback: lang.hitch(this, function(guid) { this._loadStyle(); }) }); this.subscribe({ guid: this._styleObj.getGuid(), attr: this.cssString, callback: lang.hitch(this, function(guid, attr, attrValue) { this._loadStyle(); }) }); }   This is the code used in the XML-file: <property key="styleEntity" type="entity" isPath="optional" pathType="reference" allowNonPersistableEntities="true"> <caption>Style object</caption> <category>Data source</category> <description>Style object entity</description> </property> <property key="cssString" type="attribute" defaultValue="" entityProperty="styleEntity" required="false"> <caption>CSS attribute</caption> <category>Data source</category> <description>Attribute to store the CSS input to.</description> <attributeTypes> <attributeType name="String" /> </attributeTypes> </property>   Hope that someone can help me out!   Thanks in advance!
asked
2 answers
0

Your code looks correct. Did you already debug by adding logging messages etc to see whether the subscribe code is actually being called, hence setting subscribtions? Is this._styleObject the actual object that is passed in the update function of the widget and is that the object you expect to subscribe to? 

answered
0

We also have problem with subscription of attribute changes on widget In Mx7.2. So I suggest you upgrade to another version or use mx.data.subscribe

answered