|
|
|
@ -20,13 +20,13 @@ development framework. Read more at [Why Meteor](http://www.meteorpedia.com/read
|
|
|
|
|
Simplest invocation - order will be lost when the page is refreshed: |
|
|
|
|
|
|
|
|
|
```handlebars |
|
|
|
|
{{sortable <collection|cursor|array>}} |
|
|
|
|
{{#sortable <collection|cursor|array>}} |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
Persist the sort order in the 'order' field of each document in the collection: |
|
|
|
|
|
|
|
|
|
```handlebars |
|
|
|
|
{{sortable items=<collection|cursor|array> sortField="order"}} |
|
|
|
|
{{#sortable items=<collection|cursor|array> sortField="order"}} |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
Along with `items`, `sortField` is the only Meteor-specific option. If it's missing, the package will |
|
|
|
@ -39,8 +39,8 @@ reorderings, unlike with [naive solutions](http://programmers.stackexchange.com/
|
|
|
|
|
|
|
|
|
|
## Passing options to the Sortable library |
|
|
|
|
|
|
|
|
|
{{sortable items=<collection|cursor|array> option1=value1 option2=value2...}} |
|
|
|
|
{{sortable items=<collection|cursor|array> options=myOptions}} |
|
|
|
|
{{#sortable items=<collection|cursor|array> option1=value1 option2=value2...}} |
|
|
|
|
{{#sortable items=<collection|cursor|array> options=myOptions}} |
|
|
|
|
|
|
|
|
|
For available options, please refer to [the main README](../README.md#options). You can pass them directly |
|
|
|
|
or under the `options` object. Direct options (`key=value`) override those in `options`. It is best |
|
|
|
@ -49,7 +49,7 @@ object, as this will enable designers to work without needing to inspect the Jav
|
|
|
|
|
|
|
|
|
|
<template name="myTemplate"> |
|
|
|
|
... |
|
|
|
|
{{sortable items=Players handle=".sortable-handle" ghostClass="sortable-ghost" options=playerOptions}} |
|
|
|
|
{{#sortable items=Players handle=".sortable-handle" ghostClass="sortable-ghost" options=playerOptions}} |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
Define the options in a helper for the template that calls Sortable: |
|
|
|
@ -76,7 +76,7 @@ All the original Sortable events are supported. In addition, they will receive
|
|
|
|
|
the data context in `event.data`. You can access `event.data.order` this way: |
|
|
|
|
|
|
|
|
|
```handlebars |
|
|
|
|
{{sortable items=players options=playersOptions}} |
|
|
|
|
{{#sortable items=players options=playersOptions}} |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
```js |
|
|
|
@ -104,3 +104,4 @@ If you encounter an issue while using this package, please CC @dandv when you fi
|
|
|
|
|
* Array support |
|
|
|
|
* Tests |
|
|
|
|
* Misc. - see reactivize.js |
|
|
|
|
* [GitHub issues](https://github.com/RubaXa/Sortable/labels/%E2%98%84%20meteor) |
|
|
|
|