jquery-templates

jQuery Templates are deprecated?

末鹿安然 提交于 2019-11-28 04:22:00
I see that per the jQuery plugin template page that jQuery plugins have gone from beta to deprecated without passing a real release. I can't find any info on jquery.com or their related sites about why. Or when a replacement might be available. Maybe 1.8? This is very frustrating because my project has made a big investment in jQuery templates. Now it looks like a bad investment and we're looking for something else that is jQuery-based, including JavascriptMVC. Any better suggestions? I'll be happy to take rationale or other information in the comments, but I'd prefer suggestions as answers.

<script> tag inside jquery template

时光毁灭记忆、已成空白 提交于 2019-11-28 02:28:57
问题 Backgroud: I have this template that includes videos from youtube being loaded with swfobject. Question: Is there a way to include a script tag... <script type="text/javascript"> </script> inside a jQuery Template?? <script id="filaVideoTemplate" type="text/x-jQuery-tmpl"> <!-- Some HTML here --> <script type="text/javascript"> <!-- Some javascript here --> </script> </script> Obviously it doesn't work directly, is there any way to achive the same thing without the script inside other script?

Best way to populate select list with JQuery / Json?

余生颓废 提交于 2019-11-28 01:23:59
Currently our dev team uses this pattern, but I can't help but wonder if there is a faster or more html-efficient way of accomplishing the same task. HTML <select id="myList" style="width: 400px;"> </select> <script id="myListTemplate" type="text/x-jQuery-tmpl"> <option value="${idField}">${name}</option> </script> And this is the Javascript: function bindList(url) { callAjax(url, null, false, function (json) { $('#myList').children().remove(); $('#myListTemplate').tmpl(json.d).appendTo('#myList'); }); } This is a function I wrote to do just that. I'm not sure if it's faster than jQuery

Knockout.js Templates Foreach - force complete re-render

为君一笑 提交于 2019-11-28 00:59:19
问题 By default, KO "will only render the template for the new item and will insert it into the existing DOM". Is there a way to disable this feature (as in, force KO to render all items anew)? 回答1: If you use jQuery.tmpl's native {{each koObservableArray()}} syntax Knockout cant update single items but must rerender the entire template see more here: http://knockoutjs.com/documentation/template-binding.html the template engine’s native ‘each’ support: after any change, the template engine is

Bind to simple array of strings

微笑、不失礼 提交于 2019-11-27 20:37:08
问题 If I want to bind a template to a plain old array of strings, what do I put in the ${??} expression? I hope this snippet isn't too short so as to confuse: <ul data-bind="template: { name: 'authorTemplate', foreach: authors }"> </ul> where authors is simply ["a", "b", "c"] <script type="text/x-jquery-tmpl" id="authorTemplate"> <li>${what_do_I_put_here???}</li> </script> I've tried: val value this and this.toString() . The last two displayed [object Object] so I suspect I'm pretty close there.

Access index of $parent in knockout.js

こ雲淡風輕ζ 提交于 2019-11-27 19:56:25
问题 In knockout.js 2.1.0, in a template using the foreach binding, you can access the current item's index though the $index() function. In a nested foreach binding, is there any way to access the index of the $parent from a template? Say I have a data structure like this: var application = { topModel: [ { {subModel: [{'foo':'foo'}, { 'bar':'bar'}]}, // this has top:0 and sub:0 {subModel: [{'foo2':'foo2'}, { 'bar2':'bar2'}]} // this has top:0 and sub:1 }, { {subModel: [{'foo':'foo'}, { 'bar':'bar

How to output ${expression} in Freemarker without it being interpreted?

五迷三道 提交于 2019-11-27 19:42:05
I'm trying to use Freemarker in conjunction with jQuery Templates. Both frameworks use dollar sign/curly brackets to identify expressions for substitution (or as they're called in freemarker, "interpolations") , e.g. ${person.name} . So when I define a jQuery Template with expressions in that syntax, Freemarker tries to interpret them (and fails). I've tried various combinations of escaping the ${ sequence to pass it through Freemarker to no avail - \${ , \$\{ , $\{ , etc. Inserting a freemarker comment in between the dollar and the curly (e.g. $<#-- -->{expression} ) DOES work - but I'm

load jQuery-Templates from external file?

半世苍凉 提交于 2019-11-27 12:15:56
问题 I just started using jQuery's template engine. Which looks quite nice so far. Yet i wonder if it's possible to load templates from an external file somehow. Imagine having loads of templates. This would mess up the html-code and is also not cacheable and has to be downloaded on every request. I was hoping there is a way to define them all in an external file and then load them and store the compiled templates into localStorage. Does anyone have an idea how to load them from an external file?

Simplest way to get current item index within jQuery template

懵懂的女人 提交于 2019-11-27 01:30:00
问题 I am passing an array of objects to jQuery template (official jquery-tmpl plugin): $("#itemTmpl").tmpl(items).appendTo("body"); <script id="itemTmpl" type="text/x-jquery-tmpl"> <div class="item">Name: ${name}, Index: ${???}</div> </script> What is the easiest way to display item index in the template? Preferably without using separated external functions, without changing passed object structure, and without changing template structure (converting to {{each}} ). Is there any built-in variable

jQuery Templates are deprecated?

自古美人都是妖i 提交于 2019-11-27 00:21:46
问题 I see that per the jQuery plugin template page that jQuery plugins have gone from beta to deprecated without passing a real release. I can't find any info on jquery.com or their related sites about why. Or when a replacement might be available. Maybe 1.8? This is very frustrating because my project has made a big investment in jQuery templates. Now it looks like a bad investment and we're looking for something else that is jQuery-based, including JavascriptMVC. Any better suggestions? I'll be