Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Re : Bind a child viewModel property to a property with a dynamic name from the parent

$
0
0
Did not have much time to look into this problem, but I was thinking try to solve it by defining a custom attribute, using can.view.attr; Somthing like:

  1. can.view.attr(/lookup-bind-\w+/, function(el, attrData) {
  2.   ...
  3. };
  4.  
  5. Component.extend({
  6.   tag: 'myapp-grid',
  7.   template: can.stache(... + '<myapp-grid-col-filter column="{.}" lookup-bind-kv="../filter.{{id}}"></myapp-grid-col-filter> ' +...,
  8.   viewModel: { ... }
  9. });
Inside the custom behavior function for the /lookup-bind-\w+/ attribute, I should set up the double binding between the the childs' 'kv' attribute and the parent's '../filter.{{id}}' attribute.

Does this seem like a possible solution?


Viewing all articles
Browse latest Browse all 3491

Trending Articles