Closed billysmt closed 8 years ago
I'm not seeing that problem. When I run the page below, it works:
Can you test it? If it doesn't work for you, check your version of jsrender. And/or create a jsfiddle I can look at...
<div id="result">..loading</div>
<script id="myTmpl" type="text/x-jsrender">
<div class='col-sm-{{:colWidth}} col-sm-offset-{{:colOffset}} resize-group' id='{{:id}}' data-del-target='{{:id}}' data-handles='e' is-active='{{:isActive}}' style='{{:style}}'>what</div>
</script>
<script>
var tmpl = $.templates("#myTmpl");
var html = tmpl.render({id: "fg-b36-64a", colWidth: "12", colOffset: "0", isActive: "false", style: "display: none;"});
$("#result").html(html);
var test = $("#result").html(); // gives: '<div class="col-sm-12 col-sm-offset-0 resize-group" id="fg-b36-64a" style="display: none;" is-active="false" data-handles="e" data-del-target="fg-b36-64a">what</div>'
debugger;
</script>
Hmm, Alright well looking into it a little deeper looks like the template is rendering correctly but I'm losing the style attribute after the fact somewhere in my JQuery. Sorry for the trouble. It's been a long couple days. Thanks for the help.
I'm trying to write a style attribute based on what's in a json Object.
Example, {id: "fg-b36-64a", colWidth: "12", colOffset: "0", isActive: "false", style: "display: none;"}
Template piece is as follows:
If I change style to something like ele-style, then the {{:style}} is written correctly, but when left as above it doesn't write anything. Not sure if I'm missing something or not but It seems like an issue.