SitePoint Sponsor

User Tag List

Results 1 to 16 of 16

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    Aug 2011
    Location
    Trinidad and Tobago
    Posts
    194
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Jquery, JSON, Pagenation Script

    I am looking for a tutorial to paginate JSON data. Can anyone recommend any?

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,705
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Zealot
    Join Date
    Aug 2011
    Location
    Trinidad and Tobago
    Posts
    194
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This should work thanks Paul.

  4. #4
    SitePoint Zealot
    Join Date
    Aug 2011
    Location
    Trinidad and Tobago
    Posts
    194
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Paul am having a little difficulty implementing the plugin. I have the JSON data but I need to edit it into links however I cannot seem to figure out where to do this. As the example doesn't edit the content at all. Below is a snip of my current code

    Code:
    function pagenationcallback(rtndata)
    {
    	$('#pagetitle').html("Archives");
    	var data = "<ul class='table-view table-action'>";
    	for(j=0;j<=rtndata.length;j++)
    	{
     
             data = data + "<li><a href='#' onclick='article("+ rtndata[j].id +"); return false;'>" + rtndata[j].title + "</a></li>";	
    	}
    	data = data + "</ul>";
    }
    However if I send this data to paginate it will leave out the ul tag is there any way to fix this.

  5. #5
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,705
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by skelleex View Post
    Hi Paul am having a little difficulty implementing the plugin. I have the JSON data but I need to edit it into links however I cannot seem to figure out where to do this.
    The pagination documentation seems to explain how to do that. Have you thoroughly studied that?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  6. #6
    SitePoint Zealot
    Join Date
    Aug 2011
    Location
    Trinidad and Tobago
    Posts
    194
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it seems some of the jquery code doesnt work in the version I am using so am not trying to find the equivalent of those pieces of code such as length and eq

  7. #7
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,705
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by skelleex View Post
    it seems some of the jquery code doesnt work in the version I am using
    Would it help us to help you if you gave us some more details, such as the version you are using?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •