Hi, I’ve got the following data:
"categorydata": [
{
"name": "Education",
"color": "big-red",
"order": 2
},
{
"name": "Health Services",
"color": "vitali-teal",
"order": 4
}
],
In the Algolia interface I’m able to select categorydata.name but not categorydata. If I enter it in manually I’m only getting a series of empty arrays. Ideally I’d like to use the sortBy
parameter to order the categories by their order
attribute. Is this not possible or should I configure the data differently? Thanks!
instantsearch.widgets.refinementList({
container: '#brand-list',
attribute: 'categorydata',
sortBy: ['order:asc'],
transformItems: function(items) {
console.log(items);
return items.map(function(item) {
return item;
});
},
templates: {
item: `
<li data-refine-value="{{value}}" class="ais-RefinementList-label">
<input type="checkbox" value="{{value}}" class="ais-RefinementList-checkbox" {{#isRefined}}checked{{/isRefined}} />
<a href="{{url}}">{{label}} <span class="ais-RefinementList-count">({{count}})</span><pre>{{value}}</pre></a>
</li>
`,
},
}),