jtemplate

Using jTemplate with ASP.NET MVC

In this article, Dave Ward describes how to use the jQuery plugin jTemplate to create what he calls a "client side repeater", that parses JSON data into a template on the client side. Toward the end of the article, he suggests that the template is placed in a separate file with the extension ".tpl", and that the data is loaded into the ...

How do I prevent scrolling to the top of a page when popping up a jQuery UI Dialog?

I currently use jTemplates to create a rather large table on the client, each row has a button that will open a jQuery UI dialog. However, when I scroll down the page and click on one of those buttons, jQuery dialog will open, but the scroll position get lost and the page jumps back to the top (with the blocking and the actual dialog sho...

jTemplates escape {$

Hi all, is there a way with jTemplates to escape {$, so i can use inline javascript in my onBlur like <a href="http://www.telegraaf.nl" onclick="if ( a ) {$('#something').css ('display','none');alert('some msg');}">telegraaf</a> which gets this after processTemplate: <a onclick="if ( a ) " href="http://www.telegraaf.nl"&gt; T...

jTemplates: html in variables

I'd like to include some html in a jTemplate variable - e.g. <td class="numeric">{$T.total_price}</td> Where total_price is: "$12<span>.00</span>" Is there any way I can get the span to show up as html? ...

JTemplates format Date using asp.net mvc

Hi I have the following JSON date returned from a MVC page e.g. "DateProcessed":"\/Date(1258125238090)\/" and I am using JTemplates to process the data as below. $('#result').setTemplate($("#TemplateResultsTable").html()); $("#result").processTemplate(data); This is my results template <script type="text/html" id="TemplateResults...

JTemplate template missed elements.

I have this template: <ul id="warningMessages" style="text-align: left; padding-left: 4px;"> {#foreach $T as msg} <li>{$T.msg.Value}</li> {#/for} </ul> When applied look like this: <ul> <li>Value 1</li> <li>Value 2</li> </ul> The style and id information ("id="warningMessages" style="text-align: left; paddin...

JTemplates serialization

I've been working with the JTemplates plugin which I've used to create a form that is bound to a json object via a template. Works perfectly. What I would like to do though is instead of submitting the form I'd like to re-serialize it back into the json object from which it originated and pass it back to the controller method as a json...

jTemplate and MicrosoftAjaxTemplates problem with encode or decoded html (browser not render as html)

I using jTemplate for showing rss item in my page. but description of each item not render right. My Template is: <table> <thead> <tr> <th>Date</th> <th>Title</th> <th>Description</th> </tr> </thead> <tbody> {#foreach $T.Items as post} <tr> <td>{$T.post.PubDate}</td> <td><a href="{$T....

Best way to reorder dom elements based on json data

Once I create dom elements base on json data with jtemplates, what is the best way to reorder those elements based on changes to the json data (sorting, filtering, etc.). ...

jTemplate currency with 2 decimals

I need to display a currency within a jTemplate. {parseInt($T.product.Details[0].Price).toFixed(2)} displays as 34.50, but i should be displayed with a comma like 34,50. I tried several functions to replace the point with a comma, but no luck so far. Anyone who can point me in the right direction? Mark ...

Function not found in jTemplate

Hi, I'm having a weird issue with a function I'm trying to call from within a jTemplates template giving the error "XYZ.getFriendlyName is not a function". It seems like I must have overlooked something simple, but I've tried everything I can think of and the error persists. The code looks like this: <input type="text" value="{#if $T.R...

jQuery tabs error when used with jTemplates

I am using jTemplates to format data returned from a json query. I am trying to transform the div with the id "fundingDialogTabs" into jQuery tabs after the template is processed. It renders the tab buttons, but both fragment1 and fragment2 divs are showing at the same time. I get the error "jQuery UI Tabs: Mismatching fragment identifie...

How to reference a specific object in an array of objects using jTemplates

I am using the excellent jTemplates plugin to generate content. Given a data object like this... var data = { name: 'datatable', table: [ {id: 1, name: 'Anne'}, {id: 2, name: 'Amelie'}, {id: 3, name: 'Polly'}, {id: 4, name: 'Alice'}, {id: 5, name: 'Martha'} ] }; ..I'm wondering if it is possible to directly specify an ob...

HTML image display

I have an html file where i am loading images from an xml file in to it. i am using jtemplate for that. I am getting the images properly.but i want to display them horizontaly those are coming as vertical. Please help me to do that,This is the sample. ...

Java Script JQUery

Hi I am extracting data from an xml file converting it into json and rendering the images which i am retriving to the html file via jtemplate.now i want to user scroller and scroll the images .i can call to the scroller plugin but it is not scrolling throuhg . can any one help me please. ...

How to access Javascript variable inside Jtemplate?

function(result) { var lParsedResult = result.d; var userTyp = "test"; //getting this value from some other source $("#accountList").setTemplate($("#accountListTemplate").html()); $("#accountList").processTemplate(lParsedResult); } <div id="accountList"> <script type="text/html" id="accountListTemplate"...

Does jTemplates foreach preserve the ordering of the collection?

My collection is ordered alphabetically, but when I assign the collection and load the html using jquery jtemplates, things are coming out un-ordered. {#foreach $T.results as r} <li>{$T.r.Name}</li> {#/for} Is this expected behavior? ...

[jQuery] JS inside the template

Hello, I'm trying to include some javascript code inside a template. The code of my html page : <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt; <html xmlns="http://www.w3.org/1999/xhtml"&gt; <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> ...

Strategy for determining problems with jTemplate errors?

Is there any way to process the template and be alerted to errors? ...

jQuery Autocomplete & jTemplates - handling response

Has anyone had any experience with using jTemplates to display autocomplete results. I have the following $("#address-search").autocomplete({ source: "/Address/SearchAddress", minLength: 2, delay: 400, focus: function (event, ui) { $('#address-search').val(ui.item.name); return false; }, parse: func...