Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Browse by Tags · View All
#DOTNET 33
#.NET 26
#ASP.NET 25
ASP.NET 24
brh 22
#C# 14
.NET 13
WCF 11
c# 9
#MultiThreading 7

Archive · View All
January 2011 10
September 2011 6
May 2011 6
December 2011 5
October 2011 5
June 2011 5
February 2011 3
November 2012 2
August 2012 2
April 2012 2

Implement Jquery.tmpl (template) with KnockoutJS, Asp.Net Mvc3

Apr 22 2012 7:16PM by Neeraj Kaushik   

In continuation of my previous post on search implementation using knockoutjs. In previous example I bind grid with knockoutjs observable array object. Because of observable characteristics, once view model update then knockoutjs engine render html controls which are bound to that view model. I found one problem in it when dealing with huge data.

I had a requirement to show thousands of records in grid without paging. If I use knockoutjs way of binding with html table it takes time to load and browser also popup message about “Unresponsive script” which ask to further render or to stop script.

I wanted to use same view model for data but i didn’t want to use “data-bind” attribute in html. I found one of good plugin of jquery (jQuery.tmpl) through which we can define template and can inject data in runtime. Here I’ll show you how to implement it. I am using same code base which I used in previous post.

 

How to reproduce error?

Let say I am adding 20000 employees in collection and it will render on UI.

image

Binding with HTML table:

 

image

 

I get following error message.

 

image

 

Solution:

Implementation of Jquery.tmpl

To avoid this message and to render data fast I choose jquery.tmpl to render html table.

Here are steps which will define step by step implementation:

Step1 : download Jquery.tmpl.js file from jquery

http://github.com/jquery/jquery-tmpl

http://ajax.microsoft.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js

and save in scripts folder.

You can directly reference script file as well if you want.

 

Step 2: Reference jquery.tmpl.min.js in relevant page or _layout.cshtml file.

 

<script src="@Url.Content("~/Scripts/jquery.tmpl.min.js")" 
	type="text/javascript"></script>

 

You can also give direct path from

<script src="http://ajax.microsoft.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js" type="text/javascript"></script>

 

Step 3: Create blank tbody where data will populate.

<tbody id="datalist"></tbody>

Step 4: Create template of <tr> element in which data will render.

 

image

Step 4: Populate data in template.

 

image

 

Step 5: Run application.

image

 

image

 

You can find code here.

Tags: #ASP.NET, ASP.NET, DotNet, jquery, asp.net mvc, knockoutjs,


Neeraj Kaushik
53 · 4% · 1132
2 Readers Liked this
Guru Samy Liked this on 4/23/2012 12:48:00 AM
Profile · Blog
Kirti M.Darji Liked this on 4/24/2012 1:00:00 PM
Profile · Blog · Facebook · Twitter
2
Liked
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

Your Comment


Sign Up or Login to post a comment.

"Implement Jquery.tmpl (template) with KnockoutJS, Asp.Net Mvc3" rated 5 out of 5 by 2 readers
Implement Jquery.tmpl (template) with KnockoutJS, Asp.Net Mvc3 , 5.0 out of 5 based on 2 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]