I need to integrate between KnockoutJS with YUI. I have some view models created with KnockoutJS that have observables and observable arrays. I would like to use the YUI DataTable to edit the data while also preserving the observable behavior.
The basic requirement is for YUI to set properties using a function like myViewModel.personName('Mary') instead of myViewModel.personName = Mary and get properties like myViewModel.personName() instead of myViewModel.personName
Do you have an example of something like this working? If not, should I subclass YAHOO.util.DataSource or should I implement this with a YAHOO.widget.DataTable.Formatter and implementing the editorSaveEvent?
For this integration to be interesting, the YUI widgets would be refreshed when the underlying observable is updated and vice versa. This requirement rules out using YAHOO.util.DataSource.TYPE_JSARRAY or YAHOO.util.DataSource.TYPE_JSON in the straightforward way.
Please let me know if you have an example of this or if you can point me to the right place in YUI to hook.
I got something working. I’m using a formatter like this:
And an editor like this:
I have a live sample here:
http://jsfiddle.net/chrisschoon/pLPfw/