Sort BloX Widget Carousel by Value
I am looking to find a way to use a widget script to override the sort logic for a BloX Carousel.
Use Case: I am displaying the Top 10 agents for a company and wish to sort by the production rank of the individuals as opposed to the alphabetical order of the agent's name. This would allow the user to always see the top ranked agent first and would progress to the 2nd ranked, 3rd ranked and so on.
Other details: There is no need to update the sort order or switch the direction of the sort as the ranking would drive the experience so this solution could be hard-coded in the widget script.
Hope this script works. This is to sort blox by Values. (here 2 is the index of Rank panel in your screenshot)
widget.on('queryend',function(se,ev){ ev.rawResult.values.sort(function(a, b){ var aValue = a[2].data; var bValue = b[2].data; if (aValue < bValue) return -1; if (aValue > bValue) return 1; return 0; }) })
Just curious to know - Does the value panel's sorting not work?
-Hari