leonidas / transparency

Transparency is a semantic template engine for the browser. It maps JSON objects to DOM elements by id, class and data-bind attributes.
http://leonidas.github.com/transparency/
MIT License
969 stars 112 forks source link

Rendering multiple select via directives - cannot set selected-attribute #84

Closed nnarhinen closed 11 years ago

nnarhinen commented 11 years ago

Hi, I'm trying to render a multiple select (not pre-defined values) completely via directives.

It seems I'm unable to then set the selected attribute.

I've created a fiddle to demonstrate my issue: http://jsfiddle.net/cAR7z/

I guess this is a corner case where you would want to use transparency to both create the select and to set the selected values for it, but would be nice to have.

Now I first have to create the dom using transparency and then traverse it to set the selected attributes.

In my real-world use case the selects are rendered in deep nesting when rendering a collection to a table etc so it adds a significant amount of traversal.

pyykkis commented 11 years ago

This definitely should work. I take a look.

pyykkis commented 11 years ago

Done. The fiddle you provided works now. I also added support for more idiomatic handling for boolean attributes, see http://jsfiddle.net/cAR7z/1/ for the details.