javve/list.pagination.js

List is not defined with RequireJS

Opened this issue · 11 comments

I am trying to use this plugin with RequireJS.

In my config, I already declared listjs as a dependency for this plugin.

However, when I use the plugin, I get this error Uncaught ReferenceError: List is not defined on line 521.

Can you help?

I'm also unable to get this working properly with RequireJS. I've tried a few shims and things, but nothing seems to work.

I don't know if this is the standard solution, but it seems like the List has to be made global.

So what I did is to assign the "LIST" to List in domReady function.
i.e.
in main.js:
require(['domReady', 'list'], function(domReady, LIST) {
domReady( function() {
// global
List = LIST;

Of course no need to specify the "List" in your module any more.
in your module:
define(['list.pagination'],
function(ListPagination) {
var monkeyList = new List('test-list', {
valueNames: ['name'],
page: 3,
plugins: [ ListPagination({}) ]
});

by the way, no need to add any shim in main.js to make this to work.

This will be fixed in the next version! Nice that you found the bug 👍

Any update on this? There haven't been any commits since last year. Should we consider this project abandoned?

@ReservedDeveloper I guess, nearly one year later and nothing has happend to fix it.

@javve you have a expectation to fix it ?

+1

Hi,
Is this fixed ? I still have the error Uncaught ReferenceError: List is not defined.