• Resolved colevalleygirl

    (@colevalleygirl)


    I have installed and configured this plugin (and Algolia) to give the search behaviour I want. However, my search page is configured with three facets e.g.:

    `/* Skill level refinement widget */
    search.addWidget(
    instantsearch.widgets.refinementList({
    container: ‘#facet-skill-level’,
    attributeName: ‘taxonomies.skill_level’,
    operator: “or”,
    sortBy: [‘name:asc’],
    limit: 10,
    templates: {
    header: ‘<h3 class=”widgettitle”>Skill Level</h3>’,
    item: ‘{{name}} ({{count}})’,
    },
    })
    );’

    My objective is to have a checkbox active next to the name, and then the count of items in brackets (i.e. the default template except the count is in ()

    However, my code loses the checkbox.

    What silly mistake am I making?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Hi @colevalleygirl

    Sorry about the delay in response here.

    Can you clarify what you’re trying to achieve here? For example are you trying to create a “filtered search” kind of thing? Click this checkbox to filter results to only the items that have a certain term?

    Thread Starter colevalleygirl

    (@colevalleygirl)

    Sorry — I got this sorted using the following template code:

    ` search.addWidget(
    instantsearch.widgets.refinementList({
    container: ‘#facet-skill-level’,
    attributeName: ‘taxonomies.skill_level’,
    operator: “or”,
    sortBy: [‘name:asc’],
    limit: 10,
    templates: {
    header: ‘<h3 class=”widgettitle”>Skill Level</h3>’, item: ‘<input type=”checkbox” class=”ais-refinement-list–checkbox” value=”  {{name}}” {{#isRefined}}checked=”true”{{/isRefined}}> {{name}} <span class=”ais-refinement-list–count”>({{count}})</span>’,
    },
    })
    );’

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Template for refinementList’ is closed to new replies.