Add `instance.group` back instead of changing the option object

pull/111/head
Glen Cheney 8 years ago
parent 790b957bc3
commit ef1f1f1c88
No known key found for this signature in database
GPG Key ID: 28736C2C260C298E

4
dist/shuffle.js vendored

@ -160,7 +160,7 @@ return /******/ (function(modules) { // webpackBootstrap
this.useSizer = false;
this.lastSort = {};
this.lastFilter = Shuffle.ALL_ITEMS;
this.group = this.lastFilter = Shuffle.ALL_ITEMS;
this.isEnabled = true;
this.isDestroyed = false;
this.isInitialized = false;
@ -312,7 +312,7 @@ return /******/ (function(modules) { // webpackBootstrap
// This is saved mainly because providing a filter function (like searching)
// will overwrite the `lastFilter` property every time its called.
if (typeof category === 'string') {
this.options.group = category;
this.group = category;
}
return set;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -167,10 +167,10 @@ Demo.prototype._handleSearchKeyup = function (evt) {
this.shuffle.filter(function (element, shuffle) {
// If there is a current filter applied, ignore elements that don't match it.
if (shuffle.options.group !== Shuffle.ALL_ITEMS) {
if (shuffle.group !== Shuffle.ALL_ITEMS) {
// Get the item's groups.
var groups = JSON.parse(element.getAttribute('data-groups'));
var isElementInCurrentGroup = groups.indexOf(shuffle.options.group) !== -1;
var isElementInCurrentGroup = groups.indexOf(shuffle.group) !== -1;
// Only search elements in the current group
if (!isElementInCurrentGroup) {

@ -49,7 +49,7 @@ class Shuffle {
this.useSizer = false;
this.lastSort = {};
this.lastFilter = Shuffle.ALL_ITEMS;
this.group = this.lastFilter = Shuffle.ALL_ITEMS;
this.isEnabled = true;
this.isDestroyed = false;
this.isInitialized = false;
@ -186,7 +186,7 @@ class Shuffle {
// This is saved mainly because providing a filter function (like searching)
// will overwrite the `lastFilter` property every time its called.
if (typeof category === 'string') {
this.options.group = category;
this.group = category;
}
return set;

Loading…
Cancel
Save