jquery-templates

KnockoutJS: Event object

余生长醉 提交于 2019-12-11 16:45:11
问题 This question is related to KnockoutJS: Tracking menu clicks. I have been able to tell which menu was clicked by supplying an id value. I need to change this model and use the event.target to obtain additional information. I tried this but it does not seem to work. I also created global function menuClicked : var viewModel = {}; function menuClicked(event) { var id = ($(event.target).tmplItem().data).Id; var isActive = viewModel.menuActive(); if (!isActive || viewModel.currentMenu() == id)

too much recursion using jquery templates

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 13:06:36
问题 I'm trying to render a recursive template, but I'm getting a "too much recursion" error... Can anyone tell what I'm doing wrong here?: code in jsfiddle Thanks! EDIT 1 (code added to post) : The HTML <script id="my_template" type="text/j-query-tmpl"> <ul class="modules_ul"> {{each(i, module) modules}} <li>${module.mod_name}</li> {{if module.sub_modules}} {{tmpl "my_template_compiled"}} {{/if}} {{/each}} </ul> </script> The JS var data = {"modules":[ { "id_modules": "1", "id_modules_parent": "0

jQuery Nested Templates using options parameter

天涯浪子 提交于 2019-12-11 07:02:52
问题 I don't understand how to reference the options parameter in nested templates. Please see: <div id="myContainer"></div> <script type="text/javascript"> var tmplMain = "<div><span>${title}</span>" + "<p style=\"border: solid 1px #f00\">${$item.details}</p>" + "{{tmpl \"nestedTemplate\"}}</div>"; var tmplNested = "<p style=\"border: solid 1px #0f0\">${$item.details}</p>"; var _mainTemplate = jQuery.template("mainTemplate", tmplMain); jQuery.template("nestedTemplate", tmplNested); var _data =

knockoutjs template not working

帅比萌擦擦* 提交于 2019-12-11 04:48:02
问题 I was following a video about knockout and I have no idea why my code is not working. I'm using these js scripts: <script src="assets/js/knockout-2.0.0.js" type="text/javascript"></script> <script src="assets/js/jquery-1.7.1.min.js" type="text/javascript"></script> <script src="assets/js/jquery.tmpl.min.js" type="text/javascript"></script> <h2>Friends</h2> <ul data-bind="template: {name: 'friendsTemplate', foreach:friends}"></ul> <script type="text/html" id="friendsTemplate"> <li>${ data.name

jQuery tmpl and DataLink beta

笑着哭i 提交于 2019-12-11 01:14:51
问题 Does anybody know when jQuery.tmpl and Data Link will come out of beta? There is a lot of people saying that it was going to be part of the 1.5 core. Are these 'offical' plugins dead? 回答1: jquery.tmpl has been deprecated and will not be developed in the present form. The jQuery UI team has taken control over the templating project and will start from scratch again. More info here http://blog.jquery.com/2011/04/16/official-plugins-a-change-in-the-roadmap/ http://wiki.jqueryui.com/w/page

javascript/jquery templating suggestions

泪湿孤枕 提交于 2019-12-10 16:19:16
问题 I am developing a large scale application highly dependent on javascript. Part of this will be displying information on screen. I am looking to display information on the ui and I am looking at using javascript templating to do such. I will be using the jquery framework. Any suggestions or recommendations to javascript/jquery templating frameworks? 回答1: It's not jQuery based, but according to performance tests on jsperf.com, the doT.js templating framework is consistently the fastest JS

how to tell if a property exists and is false

三世轮回 提交于 2019-12-09 12:29:32
问题 I am having a hard time determining if data passed into the jquery template exists and is false without getting errors. This is what I am using to test <html> <head> <title>jQuery Templates {{if}} logic</title> </head> <body> <p id="results"></p> <p>How do you test if the Value exists and is false?</p> <script id="testTemplate" type="text/html"> Test ${Test}: {{if Value}} Value exists and is true {{else}} Value doesn't exist or is false {{/if}} <br/> </script> <script type="text/javascript"

How can I tell Django templates not to parse a block containing code that looks like template tags?

岁酱吖の 提交于 2019-12-09 08:21:35
问题 I've got some html files that include templates to be used by jQuery.tmpl. Some tmpl tags (like {{if...}} ) look like Django template tags and cause a TemplateSyntaxError. Is there a way I can specify the Django template system should ignore a few lines and output them exactly as they are? 回答1: As of Django 1.5, this is now handled by the built-in verbatim template tag. In older versions of Django, the built-in way would be to manually escape each template item with the templatetag template

jQuery Templates vs Partial Views in ASP.NET MVC

一个人想着一个人 提交于 2019-12-09 04:44:59
问题 I'm taking a look at jQuery templates. It looks really interesting - easy syntax, easy to use, very clean. However, I can't really see why it's better to use jQuery templates instead of simply fetching partial views via AJAX. It simply seems like the partial views would be much easier to maintain and helps to avoid duplication of code. I want to use jQuery templates. But when would it be better than partial views? 回答1: I agree that these do overlap. There are several different ways to

Create another toolbar in kendo grid

我的梦境 提交于 2019-12-08 05:54:05
问题 I am using Kendo library for grid. I want to have a toolbar in that grid. I have followed this link - http://demos.kendoui.com/web/grid/toolbar-template.html and created a toolbar at the top I also want to add another toolbar at the bottom of grid. Below or above pagination bar. I could not find any way to create this extra toolbar. Please help. 回答1: There are two ways of getting it: You let Kendo UI generate in the top and then you move it to the bottom You generate it to the bottom. The