How can i change a jquery plugin's option value with my value?
Posted
by Pandiya Chendur
on Stack Overflow
See other posts from Stack Overflow
or by Pandiya Chendur
Published on 2010-04-01T07:30:41Z
Indexed on
2010/04/01
7:33 UTC
Read the original article
Hit count: 261
jQuery
|jquery-plugins
I have just jquery pagination plugin to work... But what happens is when i click page number 2
i get the first page and when i click 3
i get second page and so on....
My initial page my current page value changes to 0
instead 1
this causes the problem...
My plugin has this,
jQuery.fn.pagination = function(maxentries, opts){
opts = jQuery.extend({
items_per_page:10,
num_display_entries:10,
current_page:0,
num_edge_entries:0,
link_to:"#",
prev_text:"Prev",
next_text:"Next",
ellipse_text:"...",
prev_show_always:true,
next_show_always:true,
callback:function(){return false;}
},opts||{});
current_page
is set to 0
... I have modified the current page value in my jquery function but it doesn't seem to work....
<script type="text/javascript">
var itemsPerPage = 5;
var maxNumberOfElementsHere = 17;
$(document).ready(function() {
getRecordspage(1, itemsPerPage);
$(".pager").pagination(maxNumberOfElementsHere, {
callback: getRecordspage,
current_page: 1, // Look here i have changed this but it doesn't work...
items_per_page: itemsPerPage,
num_display_entries: 5,
next_text: 'Next',
prev_text: 'Prev',
num_edge_entries: 1
});
});
</script>
© Stack Overflow or respective owner