I think subscribing to changes on attributes is the way to go.
Be sure to subscribe to changes on the attribute specifically.
I use the snippet below in a custom date-time picker and it works perfectly.
this.subscribe({
guid: this._contextObj,
attr: this.dateAttribute,
callback: lang.hitch(this, this._setDatePicker)
});
It also listens to changes that I trigger using set() on the object in the client (without committing to the runtime).
this._contextObj.set(this.dateAttribute, event.date.valueOf());
Hope it helps!
Hi Alexander,
Not sure if this helps but as far as I know the mx.data.set only sets the value locally, meaning in the clients memory. This will cause the value to be updated if it is used in other client widgets. To send the data to the server use the mx.data.commit (the name is a bit misleading since this does not cause an actual db commit, it just sends the data to mx runtime on the server). At least this is what I think is hapening while struggling with a similar issue (I have only tried this in mx version 6.5.1)
Hope this helps,
-Andrej