radiegtya / meteoris2

a Realtime Javascript Boilerplate base on Meteor Js Framework
MIT License
246 stars 46 forks source link

hasmore function, pagintation? #71

Open marcojferreirac opened 9 years ago

marcojferreirac commented 9 years ago

Hello!

I've been using the app for quite a while now. I noticed that it has a "hasMore" function, which is for pagintation right? Although i can't get it to work... Where can i set the limit? How can i show only, for example, 3 results and then press a next button to show the next 3 results?

Thank you very much for your help!

radiegtya commented 9 years ago

in the Controllers at func subscriptions and index, simply override this value

sort.limit = this.limit();

to

sort.limit = 3;

but it's not reccomended

the reccommended one is ovverride the increment variable in your controller add this:

increment: 3

or if you want to set the whole app with limit 3, simply edit the MeteorisController increment value

marcojferreirac commented 9 years ago

Editing the increment value worked, but now a button should appear to load more results, but doesnt.

thank you!

radiegtya commented 9 years ago

which one from my answer did you used @marcojferreirac ?

marcojferreirac commented 9 years ago

Editing the MeteorisController increment value. But now, even if my collection has 10 fields, i can only access 3. The others aren't loaded/can't be accessed.

radiegtya commented 9 years ago

loadmore button also not showing?

marcojferreirac commented 9 years ago

yes, the loadmore button doesn't appear.

radiegtya commented 9 years ago

can You Please give your code at MeteorisController and YourController?

marcojferreirac commented 9 years ago

My MeteorisController code is the same as the one in gitHub, only changed "increment: 3".

My controller's code is the generated code, only changing the sort.limit in the "subscriptions" function, like below:

ItemsController = MeteorisController.extend({
 subscriptions: function() {
        var sort = MeteorisGridView.getSorting();
        sort.limit = 3;
        this.subs.subscribe('ccdocs', {});
        this.subs.subscribe('descriptions', {});
        this.subscription = this.subs.subscribe('items', this.getCriteria(), sort);
    },
});
radiegtya commented 9 years ago

Hi @marcojferreirac, I think you get me wrong. You shouldn't change the sort limit inside subscribe function, that will just subsrcibe 3 data from server and no more hardcoded. I mean you must change the MeteorisController itself, not the child. And you should change the increment variable value, not the limit.