jquery pagination plugin doesn't quite work right for me...
Posted
by Pandiya Chendur
on Stack Overflow
See other posts from Stack Overflow
or by Pandiya Chendur
Published on 2010-03-31T09:56:24Z
Indexed on
2010/03/31
10:23 UTC
Read the original article
Hit count: 180
My page has the following jquery statements,
<script type="text/javascript">
$(document).ready(function() {
getRecordspage(1, 5);
});
</script>
It works fine but how to add callback function to my pagination( callback://)
?
function getRecordspage(curPage, pagSize) {
$.ajax({
type: "POST",
url: "Default.aspx/GetRecords",
data: "{'currentPage':" + curPage + ",'pagesize':" + pagSize + "}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(jsonObj) {
var strarr = jsonObj.d.split('##');
var jsob = jQuery.parseJSON(strarr[0]);
var divs = '';
$.each(jsob.Table, function(i, employee) {
divs += '<div class="resultsdiv"><br /><span class="resultName">' + employee.Emp_Name + '</span><span class="resultfields" style="padding-left:100px;">Category :</span> <span class="resultfieldvalues">' + employee.Desig_Name + '</span><br /><br /><span id="SalaryBasis" class="resultfields">Salary Basis :</span> <span class="resultfieldvalues">' + employee.SalaryBasis + '</span><span class="resultfields" style="padding-left:25px;">Salary :</span> <span class="resultfieldvalues">' + employee.FixedSalary + '</span><span style="font-size:110%;font-weight:bolder;padding-left:25px;">Address :</span> <span class="resultfieldvalues">' + employee.Address + '</span></div>';
});
$("#ResultsDiv").append(divs).show('slow');
$(".pager").pagination(strarr[1], { // callback function call to this method
current_page: curPage-1, items_per_page: '5', num_display_entries
: '5', next_text: 'Next', prev_text: 'Prev', num_edge_entries: '1'
});
}
});
}
On the initial page load i get all divs with page numbers generated but when i click the next page number nothing happens because callback
is not configured....Because my callback function has to call the same method with the current anchor tag which is clicked... Any suggestion how to get this done.......
© Stack Overflow or respective owner