1rosehip / jplist

jPList jQuery Data Grid Controls is a flexible jQuery plugin for sorting, pagination and filtering of any HTML structure (DIVs, UL/LI, tables, etc).
http://jplist.com
Other
436 stars 177 forks source link

Pagination can support the jump to the input page? #240

Closed xuanskyer closed 7 years ago

xuanskyer commented 7 years ago

Pagination can support the jump to the input page?

1rosehip commented 7 years ago

What do you mean by input page?

xuanskyer commented 7 years ago

@1rosehip

sorry, I don't have a clear statement,like this:

page

xuanskyer commented 7 years ago

I changed the old version jplist.bootstrap-pagination-bundle.min.js.

<input name="" vlaue="" type="text" style="margin:10px;width:80px;" placeholder="jump to.."  class="jplist-jump-dest" />
//input page jump js
    jQuery(document).on('keypress', '.jplist-jump-dest', function(event){
        if(13 == event.which){
            var page_num = Number(jQuery(this).val() - 1) || 0;
            jQuery('.jplist-pagesbox').append('<button type="button" style="display: none;" data-type="page" data-number="'+page_num+'">'+page_num+'</button>');
            jQuery.each(jQuery('button[data-number='+page_num+']'),  function(){
                jQuery(this).click();return false;
            });
        }
    });

like this: changed code

ugly code , but it works! :)

1rosehip commented 7 years ago

I'm glad that it works! 👍