jQuery Pagination plugin 'page' option
I am having trouble with the jQuery Pagination plugin 'page' option (
http://www.xarg.org/2011/09/jquery-pagination-revised/). It still fetches page 1 even when it is set as 'null'.
Any help would be appreciated
- $('#SpamShortcutForm').ajaxForm({ //submit shortcut form
- success: function(results){
- //console.log('<?php echo $this->Paginator->counter(array('format' => '{:count}')); ?>');
- $(".pagination").paging(results.pcount, {
- format: '[< ncnnnnnnnn! >]', // define how the navigation should look like
- perpage: 30,
- page: null, // not working, as if it is set as 1
- onSelect: OnSelect,
- onFormat: function (type) {
- switch (type) {
- case 'block':
- if (!this.active)
- return '<span class="disabled">' + this.value + '</span>';
- else if (this.value != this.page)
- return '<em><a href="#' + this.value + '">' + this.value + '</a></em>';
- return '<span class="current">' + this.value + '</span>';
- case 'next':
- if (this.active) {
- return '<a href="#' + this.value + '" class="next">Next »</a>';
- }
- return '<span class="disabled">Next »</span>';
- case 'prev':
- if (this.active) {
- return '<a href="#' + this.value + '" class="prev">« Previous</a>';
- }
- return '<span class="disabled">« Previous</span>';
- case 'first':
- if (this.active) {
- return '<a href="#' + this.value + '" class="first">|<</a>';
- }
- return '<span class="disabled">|<</span>';
- case 'last':
- if (this.active) {
- return '<a href="#' + this.value + '" class="prev">>|</a>';
- }
- return '<span class="disabled">>|</span>';
- case 'fill':
- if (this.active) {
- return "...";
- }
- }
- return ""; // return nothing for missing branches
- }
- });
- if (results.status == 'success') {
- if (results.data.length != 0) {
- var con;
- if ($(':checked').val() === 'links') {
- con = links(results);
- } else if ($(':checked').val() === 'attach') {
- con = attachs(results);
- } else if ($(':checked').val() === 'ips') {
- con = ips(results);
- }
- $('#shortcutResults').removeClass('fail_msg').empty().append(con);
- $('#tabs-3 .paging a').each(function(i) {
- var href = $(this).attr('href');
- $(this).attr('href', href.replace('index', 'a_shortcuts'));
- });
- $('#tabs-3 .pagination').show();
- } else {
- $('#shortcutResults').empty().append('Nothing Found!').addClass('fail_msg');
- $('#tabs-3 .pagination').hide();
- }
- $('#errorMsgs').removeClass('fail_msg').empty();
- } else if (results.status == 'email_sent') {
- $('#res_eList').parent()
- .append("<span>Email sent!</span>").hide().fadeIn('slow').children('span').addClass('success_msg').delay(2000).fadeOut('slow');
- $('#errorMsgs').removeClass('fail_msg').empty();
- } else if (results.status == 'email_fail') {
- $('#res_eList').parent()
- .append("<span>"+results.data+"</span>").hide().fadeIn('slow').children('span').addClass('fail_msg').delay(2000).fadeOut('slow');
- $('#errorMsgs').removeClass('fail_msg').empty();
- } else {
- $('#errorMsgs').empty().append(results.data).addClass('fail_msg');
- }
- }
- });