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

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

$
0
0
Hi,

In this jsfiddle http://jsfiddle.net/9sbu4mew/1/, there are two components:
  • A parent component, which holds the configuration for the filter criteria of five columns;
  • A child component, which displays the filter criteria of one column;

The child's output is its 'kv' attribute, which returns the filter operator (=, <, <=, etc) and the filter value, as an object;
The parent takes the 'kv' output of each of the five children instances and binds them to an attribute of the 'filter' root attribute. The idea is to have in the 'filter' parent attribute all the children filters, with a key given by the columns id;

The problem is that the resulting filter has all the keys with an additional space after the key's name; so instead of:
  1. filter: {"id":{">=":"4"},"name":{"leftnocase":"alice"},"value":{"<":"100"}}
, I get:
  1. filter:  {"id ":{">=":"4"},"name ":{"leftnocase":"alice"},"value ":{"<":"100"}}
(notice the additional spaces after the "id", "name" and "value" keys;

Can you please hep me get rid of the additional space after the 'filter' keys?

Thanks.


Viewing all articles
Browse latest Browse all 3491

Trending Articles