DeuxHuitHuit / quicksearch

A jQuery plugin for searching through DOM Elements quickly
https://www.npmjs.org/package/jquery.quicksearch
Other
135 stars 35 forks source link

Can we hide content before to search it ? #18

Closed kodjoe closed 9 years ago

kodjoe commented 9 years ago

Hello this plugin is perfect !!!

I would like to know if it's possible to hide content of our table by defaut to be in front of a blank page before to writte something on the "search zone".

And show only things what we are looking for if they exist ???

thank you

nitriques commented 9 years ago

you can $('.selector').hide().quicksearch(...) and use the onBefore callback to check if there is something in the input field or not.

There is not option to do it, but it's pretty easy to implement it yourself.

kodjoe commented 9 years ago

oh that's will be awsome can you please give me more explications on how to do that ?

nitriques commented 9 years ago

can you please give me more explications on how to do that ?

I just did...

you can $('.selector').hide().quicksearch(...) and use the onBefore callback to check if there is something in the input field or not.

kodjoe commented 9 years ago

I don't know if i'm so far from your help, i've this js file with that -> I have to use the onbefore callback on $('.selector') or in the $(document).ready(function () {

$(document).ready(function () { $("#id_search").quicksearch("ul li", { 'noResults': '#noresults', 'stripeRows': ['odd', 'even'], 'loader': 'span.loading', 'minValLength': 2, 'onBefore': function () { console.log('on before'); } });

$('.selector').hide().quicksearch(...)

nitriques commented 9 years ago

Looks like to need to do some javascript courses. Or try posting your question on stack overflow, this place is for bug tracking.

Try:

$(document).ready(function () {
   $('#results').hide();
   $("#id_search").quicksearch("ul li", {
      'noResults': '#noresults',
      'stripeRows': ['odd', 'even'],
      'loader': 'span.loading',
      'minValLength': 2,
      'onBefore': function () {
        // Check here to see if you want to hide or not
    }
});
kodjoe commented 9 years ago

I come here because i didn't know if this function was asked or created before !! thank you so much for your help, i'll continu on stackoverflow ;)

nitriques commented 9 years ago

no problem. please come back if you find a bug.