From 8510d422ffb574d97efa9c116df680d4c93ca613 Mon Sep 17 00:00:00 2001 From: Uros Smolnik Date: Mon, 27 Jul 2015 12:21:44 +0200 Subject: [PATCH] meteor: option to specify collection selector --- meteor/README.md | 14 ++++++++++++++ meteor/reactivize.js | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/meteor/README.md b/meteor/README.md index c340358..e5cacc3 100644 --- a/meteor/README.md +++ b/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 diff --git a/meteor/reactivize.js b/meteor/reactivize.js index a068a5e..42a4bef 100644 --- a/meteor/reactivize.js +++ b/meteor/reactivize.js @@ -90,7 +90,7 @@ Template.sortable.created = function () { */ templateInstance.adjustOrders = function adjustOrders(itemId, orderPrevItem, orderNextItem) { var orderField = templateInstance.options.sortField; - var selector = {}, modifier = {$set: {}}; + var selector = templateInstance.options.selector || {}, modifier = {$set: {}}; var ids = []; var startOrder = templateInstance.collection.findOne(itemId)[orderField]; if (orderPrevItem !== null) {