Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use headers and nodata at the same time #48

Open
grantmccall opened this issue Jan 26, 2017 · 1 comment
Open

Can't use headers and nodata at the same time #48

grantmccall opened this issue Jan 26, 2017 · 1 comment

Comments

@grantmccall
Copy link

grantmccall commented Jan 26, 2017

Using nodata on it's own seems to work ok, as in:

$('#search').hideseek({
  nodata: 'No results found'
});

However adding another option, like headers stops the nodata message from appearing, this doesn't work:

$('#search').hideseek({
  nodata: 'No results found',
  headers: '.category-header'
});

Am I doing something wrong?

@shannonschaerer
Copy link

shannonschaerer commented Mar 21, 2017

Maybe I am doing something wrong as well as I had a similar problem. I had to dig in the plugin, but I was anyway already digging due the "with" function in the highlight plugin. Won't compile with babble. Anywho...

I added a conditional to check for the "ignore" option and then to check the remaining "li's", mine with a class of food, against the original conditional from the plugin. So far it seems to work.

` if ($this.opts.nodata) {

    $list.find('.no-results').remove();
      
    if ($this.opts.ignore) {
        if(!$list.children('.food:not([style*="display: none"])').length) {
            console.log('we are in')
            $list
                .children()
                .first()
                .clone()
                .removeHighlight()
                .removeClass('category')
                .addClass('no-results')
                .show()
                .prependTo($this.opts.list)
                .text("Keine Treffer");

            $this.trigger('_after_nodata');
        }
    }
    if (!$list.children(':not([style*="display: none"])').length) {

      $list
        .children()
        .first()
        .clone()
        .removeHighlight()
        .addClass('no-results')
        .show()
        .prependTo($this.opts.list)
        .text("Keine Treffer");

      $this.trigger('_after_nodata');

    }

  }`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants