New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: Cannot read property 'helpers' of undefined #95

Closed
AlmogRnD opened this Issue Nov 26, 2014 · 11 comments

Comments

Projects
None yet
7 participants
@AlmogRnD

AlmogRnD commented Nov 26, 2014

I'm getting the following error, my code is based on the basic example
Uncaught TypeError: Cannot read property 'helpers' of undefined

@alethes

This comment has been minimized.

Owner

alethes commented Nov 26, 2014

As in the other issue, in order to help I'd have to see your code.

@AlmogRnD

This comment has been minimized.

AlmogRnD commented Nov 26, 2014

Same code as the last ticket but I just tried it with a collection - Organizations

@alethes

This comment has been minimized.

Owner

alethes commented Nov 26, 2014

It's probably because there's no template called "Organizations". There are two solutions:

  1. Changing the name of the template containing {{> pages}} and {{> pagesNav}} to "Organizations"
  2. Passing the "templateName" option to the Meteor.Pagination constructor:
Pages = new Meteor.Pagination({
  templateName: "organizationUsers",
  ...
});

@alethes alethes closed this Mar 7, 2015

@winstoncse

This comment has been minimized.

winstoncse commented Apr 23, 2015

seems like the order of how your define your package matters, inside my package.js, i put the common file I used to call new Meteor.Pagination last, so the depended Template(where I call {{> pages}} ... could be loaded before Pages.coffee runs and it works :D

this.Pages = new Meteor.Pagination({
templateName: "yourTemplateName",
...
});

api.add_files([
'lib/common/pagination/common.js'
], ['client', 'server']);

@diego2013

This comment has been minimized.

diego2013 commented May 8, 2015

I got here due to the same issue. What @alethes said solved the problem for me. Just wanted to point out that the documentation (meaning, the README.md file) instructs to use

 this.Pages = new Meteor.Pagination("collection-name", {
  itemTemplate : "myItemTemplate"
})

This crashed in my code (iron router could not find the routes and the helpers couldn't be found either). Everything got fixed by using

 this.Pages = new Meteor.Pagination("collection-name", {
  templateName: "myItemTemplate"
})

Should the README.md be corrected or is there something else I don't understand going on when passing the template name to the pagination constructor?

@metalik

This comment has been minimized.

metalik commented May 21, 2015

I am using v1.8.4 and also got this Uncaught TypeError: Cannot read property 'helpers' of undefined

I am using iron-router and have already provided the routerTemplate and itemTemplate settings

this.Pages = new Meteor.Pagination(Posts, {
  router: "iron-router",
  homeRoute: "/",
  route: "/",
  routerTemplate: "postsList",
  routerLayout: "layout",
  itemTemplate: "postItem"
});
@alethes

This comment has been minimized.

Owner

alethes commented May 21, 2015

Try using templateName instead of routerTemplate.

@metalik

This comment has been minimized.

metalik commented May 21, 2015

Got blank page when using templateName instead of routerTemplate
However, it works when I have specified both templateName and routerTemplate

@valorloff

This comment has been minimized.

valorloff commented Mar 26, 2017

prodPages = new Meteor.Pagination('Products', {

  router: "iron-router",
  homeRoute: "/lastupdates",
  route: "/lastupdates",
  templateName: "adminLastUpdates",
  routerLayout: "adminNav",
  itemTemplate: 'adminProduct',
  sort: {'lastmod': -1}
  });

Uncaught TypeError: Cannot read property 'renderFunction' of undefined

@valorloff

This comment has been minimized.

valorloff commented Mar 26, 2017

Pages = new Meteor.Pagination('Products', {
  router: 'iron-router',
  route: '/lastupdates/',
  routerTemplate: 'adminLastUpdates',
  templateName:   'adminLastUpdates',
  routerLayout: "adminNav",
  itemTemplate: 'adminProduct',
  sort: {'lastmod': -1}
  });

Uncaught TypeError: Cannot read property 'renderFunction' of undefined

@PrakashSasi

This comment has been minimized.

PrakashSasi commented Mar 31, 2017

how to use this Package in meteor . i dont understand your Example and Read me file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment