Hey,
I have an observable object looking something like this:
So far so good. No I want to use this filtered array in a source binding (to generate a table, say) and I want to to the following:
Where availableDescription is an array contained in my viewModel.
This generates an error (Uncaught TypeError: Object [object Array] has no method 'parent' )
Apparently kendo is resolving 'availableDescriptions' by calling 'parent()' on the observable array that is the context for my template. To work around this I changed my implementation of filteredArray to look like this:
It works, but isn't particularly graceful. Is there a better way to do this ?
I have an observable object looking something like this:
1.viewModel = kendo.observable({2. anArray: ['item1', 'item2', '...'],3. filteredArray: function() {4. return this.get('actions').filter(function (el) {5. return someLogic(el);6. });7. }
8.});1.<script id="row-template" type="text/x-kendo-template">2. <tr>3. [...]4. <td><select data-bind="source: availableDescriptions, value: Description"/></td>5. </tr>6.</script>This generates an error (Uncaught TypeError: Object [object Array] has no method 'parent' )
Apparently kendo is resolving 'availableDescriptions' by calling 'parent()' on the observable array that is the context for my template. To work around this I changed my implementation of filteredArray to look like this:
1.filteredArray: function () {2. var a = this.get('actions').filter(function (el) {3. return doSomething(el);4. });5. a.parent = function () { return this; };6. return a;7.}