Browse Source

Merge pull request #493 from urossmolnik/master

meteor: option to specify collection selector
pull/504/head
Lebedev Konstantin 9 years ago
parent
commit
d835ba6eff
  1. 14
      meteor/README.md
  2. 2
      meteor/reactivize.js

14
meteor/README.md

@ -81,6 +81,20 @@ Template.myTemplate.helpers({
}); });
``` ```
#### meteor specific options
* `selector` - you can specify collection selector if your list operates only on subset of collection. Example:
```js
Template.myTemplate.helpers({
playerOptions: function() {
return {
selector: { city: 'San Francisco' }
}
}
});
```
## Events ## Events

2
meteor/reactivize.js

@ -90,7 +90,7 @@ Template.sortable.created = function () {
*/ */
templateInstance.adjustOrders = function adjustOrders(itemId, orderPrevItem, orderNextItem) { templateInstance.adjustOrders = function adjustOrders(itemId, orderPrevItem, orderNextItem) {
var orderField = templateInstance.options.sortField; var orderField = templateInstance.options.sortField;
var selector = {}, modifier = {$set: {}}; var selector = templateInstance.options.selector || {}, modifier = {$set: {}};
var ids = []; var ids = [];
var startOrder = templateInstance.collection.findOne(itemId)[orderField]; var startOrder = templateInstance.collection.findOne(itemId)[orderField];
if (orderPrevItem !== null) { if (orderPrevItem !== null) {

Loading…
Cancel
Save