Skip to content Skip to sidebar Skip to footer

I'm Trying To Build Up Options From An Array Data Value Using Jsview

if you have an array of items, without properties, how do you access the value inside a for loop? I currently get the right number of options, but I haven't found the correct synta

Solution 1:

If options is an array of strings, you need:

<selectdata-link="dec">
    {^{for options}}
        <optionvalue="{{:#data}}">{{:#data}}</option>
    {{/for}}
</select>

Note also the data-link expression on the select element.

In general, in your jsfiddle, you can use data-linking much more. For example:

<div>{^{>dec}}</div>

(Note the ^)

And to do data-linking you need

$template.link("#container", data);

rather than just calling render...

There are more changes needed, but here is an update of your jsfiddle which does select binding: http://jsfiddle.net/BorisMoore/Y44Gm/5/

Post a Comment for "I'm Trying To Build Up Options From An Array Data Value Using Jsview"