Vestride / Shuffle

Categorize, sort, and filter a responsive grid of items

Home Page:https://vestride.github.io/Shuffle/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Get the order of visible items after sorting

flozzel opened this issue · comments

For example I have an usecase where the user filters for a category.
After filtering not all items are visible anymore, but only those that match the filter.

Via the shuffleInstance.items array you can now see which items are visible and which are not

0: Object { id: 1, isRTL: false, isVisible: true, … }
​1: Object { id: 2, isRTL: false, isVisible: false, … }
​​2: Object { id: 3, isRTL: false, isVisible: true, … }
​​3: Object { id: 4, isRTL: false, isVisible: false, … }
.....

But it is possible to draw conclusions about the order in which the items are displayed?
Especially after the sorting was changed.

The order of the items in the DOM remains unchanged, just as the order of the entries in the shuffleInstance.items array.
Only the absolute positioning in the CSS of the shuffle elements changes.

I was thinking about that you could possibly calculcate the order of the items over the "point" property that each item in the shuffleInstance.items array has.

But surely there is a simpler solution to obtain the order of the visible items and I think to complicated.

Duplicate of #268