How to load refinement list randomly

wordpress
refinementlist

#1

Hi,

I have created a refinement list to show author lists.

       search.addWidget(
            instantsearch.widgets.refinementList({
                container: '#social-peace-refinementlist2',
                // attributeName: 'post_author.display_name',
                attributeName: 'post_author.user_login',
                autoHideContainer: false,
                limit: 5,
                templates: {
                    item: function item(data) {
                        var output = "";
                        output = '<figure class="social-fig">  <img src="' + ng_users[data.name].avatar + '" width="96" height="96" class="avatar avatar-96 wp-user-avatar wp-user-avatar-96 alignnone photo"><figcaption> '+ ng_users[data.name].display_name +' </figcaption></figure>';

                        return output;
                    }
                }
            })
        );

So basically it show just 5 author at a time. I have button beside list.

which will help me to refresh the list so on click of button the list will show new authors.
but the count will always remain 5.

I didn’t find any luck to manage it in that way.
can anyone help me?

How can I load refinement list randomly or can show other author in list?


#2

Hi @1naveengiri
Refinement is not intended to show random results but specifically facetValues that can be found on hits matching the query.

However what you want to do is possible.

You can create a custom RefinementList like explained in our docs than instead of displaying the provided items, display your own list of items which can be randomly sorted at each click of your button.

Let us know if this sounds like what you want.


#3

Thanks for your time @Youcef

I want to make code changes minimum, I will think on this aspect if nothing work usual.

So is there any way to show refinement list in pagination form?
slide a slider on each slide I will have 3 refinement items.
can I do that in anyway?