Reputation: 1
I'm new to Meteor and Javascript.
I'm trying to implement the sort library found here:
https://github.com/RubaXa/Sortable/tree/master/meteor
I know this is probably simple, but the simpliest invocation of the code here: {{sortable }}
still leaves me a bit baffled. I've tried passing collections like:
{{sortable PlayersList}}
but, have no idea what the output is supposed to be. I learn by example, can someone help me out by giving me the quickest implementation of the library?
This is my first time posting on a forum in a long time. I usually can Google-Fu my way around.
Here is my html file:
` sortof
{{> hello}}
Unsorted: {{#each showplayers}}
<li>{{name}}: {{score}}</li>
{{/each}}
Sorted:
{{#sortable items=PlayersList}}
{{#each name}}
hi
<li>{{name}}: {{score}}</li>
{{/each}}
{{/sortable}}
`
and here is my web output:
` Welcome to Meteor!
Unsorted: Bob: 0 Larry: 0 Henry: 0 Sorted:
`
Thanks!
Upvotes: 0
Views: 1191
Reputation: 5088
The following should work:
<template name="myTemplate">
{{#sortable items=players}}
</template>
Template.myTemplate.helpers({
players: function () {
return Players.find();
}
});
And for more complex examples, see:
HTML: https://github.com/RubaXa/Sortable/blob/master/meteor/example/client/define-object-type.html
JS: https://github.com/RubaXa/Sortable/blob/master/meteor/example/client/define-object-type.js
Upvotes: 0