alethes / meteor-pages

Meteor pagination
MIT License
404 stars 84 forks source link

navTemplate option doesn't work? #152

Open SystemZ opened 9 years ago

SystemZ commented 9 years ago

Hello,

In documentation I can find navTemplate setting. Unfortunately after declaring it to 'paginationNav' like this:

Games = new Mongo.Collection("games");
GameFields = ["name", "tags"];
Gamez = new Meteor.Pagination(Games, {
    perPage: 5,
    itemTemplate: "game",
    navTemplate: "paginationNav",
    table: {
        class: "striped centered",
        fields: GameFields,
        header: _.map(GameFields, function (f) {
            return f[0].toUpperCase() + f.slice(1);
        }),
        wrapper: "table-wrapper"
    },
    sort: {
        name: 1
    },
    availableSettings: {
        perPage: true,
        filters: true
    }
});
<template name="paginationNav">
    {{#if show}}
    <div style="text-align:center" data-pages="{{name}}" class="pagination-cont">
        <ul class="pagination">
            {{#each navigationNeighbors}}
            <li class="{{active}} {{disabled}}">
                <a href="{{link}}">{{p}}</a>
            </li>
            {{/each}}
        </ul>
    </div>
    {{/if}}
testtesttesttest
</template>
<template name="games">
    {{> pagesNav}}
    <button class="perPage btn-floating teal" data-pp="5">5</button>
    <button class="perPage btn-floating teal" data-pp="20">20</button>
    <button class="perPage btn-floating teal" data-pp="50">50</button>
    <button class="perPage btn-floating teal" data-pp="100">100</button>
    <form id="search">
        <input style="width:100%" id="search_input" autocomplete="off" type="text" name="search" placeholder="Search for games or tags"/>
    </form>
    {{> pages}}
</template>

There is only "testtesttesttest" appearing, no show or navigationNeighbors is set. Am I missing something?

charleshan commented 9 years ago

I'm having the same issue. I was able to get {{show}} and {{name}} by using https://atmospherejs.com/aldeed/template-extension to replace _pagesNav Template but still nothing for navigationNeighbors. @SystemZ have you found anything new?

SystemZ commented 9 years ago

Currently my project in meteor is frozen, I still have this issue.

panphora commented 9 years ago

This is because the navTemplate setting is private and not modifiable by the client. See the docs.

In order for this to work the package would have to be changed to allow people to customize the navTemplate setting. See this issue: https://github.com/alethes/meteor-pages/issues/166