matteodem / meteor-easy-search

Easy-to-use search for Meteor with Blaze Components
MIT License
436 stars 68 forks source link

Adding facets to your search app #537

Closed demiantriebl closed 7 years ago

demiantriebl commented 8 years ago

hi! i can search with a select like the documentation but i need to use a radio button with true or false. I have tried everything but i can't make it work

matteodem commented 8 years ago

What does "tried everything" mean?

demiantriebl commented 8 years ago

hi, i need 3 days to work. but when i decide post then i can resolve this. i use this on blaze

 <input type="radio" class="magiaFiltro" name="magia" value="" checked>Todos<br>
                    <input type="radio" class="magiaFiltro" name="magia" value="Magica"> Magica<br>
                    <input type="radio" class="magiaFiltro" name="magia" value="Convencional"> Convencional

on the .js use

 'change .magiaFiltro': function (e) {
        var radio = $('input:radio[name=magia]:checked').val();
        PlayersIndex.getComponentMethods()
                .addProps('magiafilter', radio);

    },

and in the model logic use

` selector: function (searchObject, options, aggregation) { let selector = this.defaultConfiguration().selector(searchObject, options, aggregation), categoryFilter = options.search.props.categoryFilter;

            magiafilter = options.search.props.magiafilter;
           if (!_.isEmpty(magiafilter) && magiafilter == "Magica") {
            selector.magia = true;
        }else if (_.isEmpty(magiafilter) && magiafilter == "Convencional"){
            selector.magia = false;
        }

`

thanks for all!!!

matteodem commented 7 years ago

Please refer to the recipes http://matteodem.github.io/meteor-easy-search/docs/recipes/