https://github.com/tamino-martinius/meteor-method-pagination
https://github.com/tamino-martinius/meteor-method-pagination
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/tamino-martinius/meteor-method-pagination
- Owner: tamino-martinius
- Created: 2014-02-25T13:50:57.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2014-03-31T08:32:48.000Z (about 11 years ago)
- Last Synced: 2025-01-31T22:25:52.621Z (3 months ago)
- Language: CoffeeScript
- Size: 208 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# method-pagination
Paging with `Meteor.methods` as Source
## Client Source
JavaScript
```
var paging;paging = null;
Template["name"].created = function() {
return paging = new Paging({
method: "getRecords",
pageSize: 5
});
};Template["name"].helpers({
paging: function(options) {
return paging.render(options.fn);
}
});
```CoffeeScript
```
paging = nullTemplate["name"].created = () ->
paging = new Paging
method: "getRecords"
pageSize: 5Template["name"].helpers
ctx: -> paging
```Spacebars
```
{{#paging context=ctx}}
{{#if items}}
{{#each items}}
{{/each}}
{{> paging_pagination}}
{{else}}
No Data
{{/paging}}```
## Server Source
JavaScript
```
Meteor.methods({
"getRecords": function(params, pageSettings) {
if (this.userId != null) {
return getPaging(records, {}, pageSettings);
} else {
throw new Meteor.Error(503, "Nice try");
}
}
});
```CoffeeScript
```
Meteor.methods
"getRecords": (params, pageSettings) ->
if @userId?
return getPaging records, {}, pageSettings
else
throw new Meteor.Error 503, "Nice try"
```