question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

customRenderPagination parameter Question

See original GitHub issue

I’m trying to utilize the customRenderPagination parameter for the Pagination component, but am unable to get the custom template rendered as expected. Is my usage of the component incorrect, or is there something else going on? I did not see the parameter used in the leaderboard example to compare against.

The code below shows a basic program attempting to utilize the parameter. Thanks for this awesome package.

JS

People = new Mongo.Collection('people');
Factory.define('person', People, Fake.user({ fields: [ 'name', 'email',
               'surname']}));

PeopleIndex = new EasySearch.Index({
  collection: People,
  fields: ['name', 'email'],
  engine: new EasySearch.Minimongo()
});

if (Meteor.isClient) {
  Template.main.helpers({
    'peopleIndex': function() {
      return PeopleIndex;
    }
  });
}

if (Meteor.isServer) {
  Meteor.startup(function () {
    var numPeople = People.find().fetch().length
    if(numPeople < 100) {
      for(numPeople; numPeople < 100; numPeople++) {
        Factory.create('person', Fake.user({ fields: [ 'name', 'email',
               'surname']})); 
      }
    }
  });
}

HTML

<head>
  <title>learn_easy_search</title>
</head>

<body>
  <h1>Welcome to Meteor!</h1>
  {{> main}}
</body>

<template name="main">
  Search: {{> EasySearch.Input index=peopleIndex}}
  <h2>People</h2>
  <ul>
    {{#EasySearch.Each index=peopleIndex}}
      <li>{{name}}</li>
    {{/EasySearch.Each}}
  </ul>
  {{> EasySearch.Pagination index=peopleIndex maxPages=10 
  customRenderPagination=test}}
</template>

<template name="test">
  <h3>Testing Custom Pagination Template</h3>
</template>

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
matteodemcommented, Apr 1, 2016

No there’s not right now, I’ll create an issue to add an example to the docs.

0reactions
WayneUongcommented, Apr 1, 2016

I there an example of how customRenderPagination works? It’s displaying the template but I’m not sure how to get the template to work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Build a Custom Pagination Component in React
We render the Pagination component as a list with left and right arrows which handle the previous and next actions the user makes....
Read more >
How To Build Custom Pagination with React | DigitalOcean
In this tutorial, you will learn how to build a custom pagination component with React for paginating large datasets.
Read more >
Custom pagination in datatables using count as parameter
I am using datatable(datatables.net) to display rows of data. For performance issues...instead of loading hundreds of rows , based upon the ...
Read more >
React pagination from scratch using Hooks - LogRocket Blog
It takes a single argument, which is the initial state. In the example above, the currentPage variable is set to 1 by default....
Read more >
Simple Frontend Pagination | React - YouTube
In this video we will implement some custom pagination in React to get a certain number of fetched posts per page. We will...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found