How to paginate json data?

Posted by Pandiya Chendur on Stack Overflow See other posts from Stack Overflow or by Pandiya Chendur
Published on 2010-03-24T06:25:33Z Indexed on 2010/03/24 6:33 UTC
Read the original article Hit count: 238

Filed under:
|
|

I used json data and iterated div elements to get my result....

function Iteratejsondata(HfJsonValue) {
    //var jsonObj = eval('(' + HfJsonValue + ')');
    var jsonObj = JSON.parse(HfJsonValue);
    for (var i = jsonObj.Table.length - 1; i >= 0; i--) {
        var employee = jsonObj.Table[i];
        $('<div class="resultsdiv"><br /><span class="resultName">' + employee.Emp_Name + '</span><span class="resultfields" style="padding-left:100px;">Category&nbsp;:</span>&nbsp;<span class="resultfieldvalues">' + employee.Desig_Name + '</span><br /><br /><span id="SalaryBasis" class="resultfields">Salary Basis&nbsp;:</span>&nbsp;<span class="resultfieldvalues">' + employee.SalaryBasis + '</span><span class="resultfields" style="padding-left:25px;">Salary&nbsp;:</span>&nbsp;<span class="resultfieldvalues">' + employee.FixedSalary + '</span><span style="font-size:110%;font-weight:bolder;padding-left:25px;">Address&nbsp;:</span>&nbsp;<span class="resultfieldvalues">' + employee.Address + '</span></div>').insertAfter('#ResultsDiv');
    }
    $(".resultsdiv:even").addClass("resultseven");
    $(".resultsdiv").hover(function() {
        $(this).addClass("resultshover");
    }, function() {
        $(this).removeClass("resultshover");
    });
}

I get 22 records in total... Now i want to paginate these divs (i.e) 5 divs per page... Any suggestion...

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about JSON