Skip to content

Add ajax load more style button to the symfony2 knp paginator plugin

License

Notifications You must be signed in to change notification settings

speto/knppaginator-ajax

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

knppaginator-ajax

Add ajax load more style button to the symfony2 knp paginator plugin

You should include the javascript file after jquery. This script only works with https://github.com/KnpLabs/KnpPaginatorBundle with this options.

knp_paginator:
    ..
    default_options:
        ..
    template:
        pagination: KnpPaginatorBundle:Pagination:twitter_bootstrap_v3_pagination.html.twig
        ..

After {{ knp_pagination_render(products) }} you shoul call

$(function() {
    var knp = new KnpPaginatorAjax();

    knp.init({
        'loadMoreText': 'Load More', //load more text
        'loadingText': 'Loading..', //loading text
        'elementsSelector': '#elements', //this is where the script will append and search results
        'paginationSelector': 'ul.pagination', //pagination selector
    });
});

knp.setAjaxLoadedContent(html); is used when you need to reload pagination because you've added content manually with javascript.

About

Add ajax load more style button to the symfony2 knp paginator plugin

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%