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.

Clear choices on search

See original GitHub issue

Wanted to use this with remote data, Im prb just using it wrong But what I wanted to repopulate the dropdown when trying into the search box Nothing have to be changed without user selection a row Thx

      this.Choices = new choises(this.element,{
      callbackOnChange : (value) => {
          //this triggers, ok
      },
      callbackOnSearch : (value)=>{
        //this triggers, but setvalue cant be used, it just adds all the time, and set input value to one of the rows
//tried setChoises to but nothing happend

      }
    });

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
vegarringdalcommented, Oct 18, 2016

great thx.

A option to the setChoises could have been a solution to setChoices(choices, value, label, replaceChoises) if true if replaces the existing.

Is it possible to have one label for the dropdown and another one for the label that get set? Was thinking about using the callbackOnCreateTemplates, but looks like you cant pass additional data inn with setChoises() and use them

setChoices([
            {value: 'One', label: 'Label One', otherLabel:"something else"},
            {value: 'Two', label: 'Label Two', otherLabel:"something else"},
            {value: 'Three', label: 'Label Three',otherLabel:"something else",},
        ], 'value', 'label');

callbackOnCreateTemplates: function (instance, template) {
      var classNames = instance.config.classNames;
      return {
        item: (data) => {
          return template(`
            <div class="${classNames.item} ${data.highlighted ? classNames.highlightedState : classNames.itemSelectable}"  data-item data-id="${data.id}" data-value="${data.value}" ${data.active ? 'aria-selected="true"' : ''} ${data.disabled ? 'aria-disabled="true"' : ''}>
              <span>&bigstar;</span> ${data.label}
            </div>
            `);
        },
        choice: (data) => {
          return template(`
            <div class="${classNames.item} ${classNames.itemChoice} ${data.disabled ? classNames.itemDisabled : classNames.itemSelectable}" data-select-text="${instance.config.itemSelectText}" data-choice ${data.disabled ? 'data-choice-disabled aria-disabled="true"' : 'data-choice-selectable'} data-id="${data.id}" data-value="${data.value}" ${data.groupId > 0 ? 'role="treeitem"' : 'role="option"'}>
                <span>&bigstar;</span> ${data.label} ${data.otherLabel}
              </div>
            `);
        },
      };
1reaction
vegarringdalcommented, Oct 18, 2016

my bad, setChoises worked, sorry 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

Clear Choice Enterprises
Use our state-of-the-art Property Search, including an interactive map search, to find homes for sale in Pittsburgh, PA. These listings are updated daily ......
Read more >
Manage & delete your Search history - Android - Google Support
Delete Search history saved to your Google Account. Manage Search settings like what activity Google saves and when Google auto-deletes your history.
Read more >
Property Appraiser Links, Tax Collector Link, Official Real ...
Tax Collector http://www.citrustc.us/. Official Records http://search.clerk.citrus.fl.us/LandmarkWeb ... 2022, Clear Choice Title, Inc. All Rights Reserved.
Read more >
Search - Clear Choices Podcast
My guest today, Stu Massengill, is on a mission to change the statistic that 80% of people don't love what they do. He...
Read more >
Clear Choices Podcast on Apple Podcasts
Welcome to the Clear Choices podcast! This podcast is designed to guide you to make more conscious and powerful choices and inspire a...
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