Skip to content

parenthesislab/knppaginator-ajax

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 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.

Usage with Symfony 4+ and Webpack

// assets/js/app.js

import { KnpPaginatorAjax } from '../../vendor/nacholibre/knppaginator-ajax/dist/js/knppaginator-ajax.js';

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
});

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy