question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Search and Options not working together

See original GitHub issue

Summary

When trying to use options, search and searchField together the list is not filtered correctly.

Steps to reproduce

Ember: 2.11.0
Ember Data: 2.11.0
jQuery: 2.2.4
Ember Power Select: 1.5.0-beta.2
{{#power-select
  searchEnabled=true
  search=(action "search")
  searchField="name"
  placeholder="All"
  options=locations
  selected=(find-by "id" location locations)
  onchange=(action "changeLocation")
  as |loc|
}}
  {{loc.name}}
{{/power-select}}
import Ember from 'ember';

const { run, RSVP: { Promise } } = Ember;

export default Ember.Component.extend({
  location: null,

  store: Ember.inject.service(),

  locations: Ember.computed(function() {
    return this.get('store').peekAll('location');
  }),

  queryLocations(name, resolve) {
    return this.get('store')
      .query('location', { name })
      .then(resolve);
  },

  actions: {
    changeLocation(location) {
      if (!location) {
        this.set('location', null);
        return;
      }

      this.set('location', location.get('id'));
    },

    search(name) {
      return new Promise(resolve =>
        run.debounce(this, this.queryLocations, name, resolve, 500)
      );
    },
  },
});

Expected behaviour

  • Open drop down
  • Observe list is populated with locations
  • Begin typing in search
  • Observe list begins filtering locations immediately
  • AJAX request sent after debounce timeout
  • Additional matching locations are added to the filtered list

Actual behaviour

  • Open drop down
  • Observe list is populated with locations
  • Begin typing in search
  • Loading message is displayed, but list is not filtered
  • AJAX request sent after debounce timeout
  • Additional matching locations are appended the list
  • Non-matching locations are not hidden from the list
  • Either
    • Typing another matching character correctly filters the list
    • Removing the query then re-typing correctly filters the list

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
cibernoxcommented, May 15, 2017

search trumps over anything else.

0reactions
nmeccommented, May 29, 2019

Unfortunately not, the best we got was removing the options and relying on search which wasn’t ideal.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix File Explorer Search Not Working in Windows 10 / 11
Fix 2 – Restart file explorer · 1. Press CTRL + SHIFT + Esc keys together to open Task manager. · 2. Now,...
Read more >
Fix site display issues with Compatibility View in Internet ...
Learn how to fix website display problems using Compatibility View in Internet Explorer.
Read more >
Start Menu or Taskbar Search Not Working in Windows 10/11
Go to Settings -> Search -> Searching Windows. · The “Search and Indexing Services” troubleshoot wizard should launch; · Select your problem (most...
Read more >
Understand & manage your location when you search on ...
When you search on Google, like with Maps, Search or Google Assistant, your current location is used to give you more helpful results....
Read more >
Fix: Windows 11 Search Menu Not Working - YouTube
In this video I will show you how to Fix: Windows 11 Search Menu Not Working. Partnerships/Business: itstechbased@outlook.com Join our ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found