GithubHelp home page GithubHelp logo

Comments (6)

th3fallen avatar th3fallen commented on April 28, 2024 1

good god..... man it sucks being stupid... lol that's exactly it...

from choices.

jshjohnson avatar jshjohnson commented on April 28, 2024

Adding a callback for when an item is highlighted/unhighlighted (i.e. clicked) would be really simple to implement. Adding a callback for when an item is being edited is slightly tricker but theoretically still possible. I'll look into this shortly.

from choices.

jshjohnson avatar jshjohnson commented on April 28, 2024

I have added two new callbacks as of version 1.0.50:

On highlight: https://github.com/jshjohnson/Choices#callbackonhighlightitem
On unhighlight: https://github.com/jshjohnson/Choices#callbackonunhighlightitem

from choices.

th3fallen avatar th3fallen commented on April 28, 2024

Man you're the best! but sadly the callbacks dont seem to be firing?

initChosen() {
    Object.assign({}, {
      ...this.props,
      callbackOnHighlightItem: this.onHighlight,
    });
    new Choices('.chosen-tag', { ...this.props });
  }

  onHighlight(k, v) {
    console.log('im a highligher');
    console.log(k, v);
  }

I can see the redux action firing but no callback is fired. am i missing something?

from choices.

jshjohnson avatar jshjohnson commented on April 28, 2024

Hmm, it's working for me. If you go to the demo page, open the console and click the items in the first input box, they should be firing (you may need to clear your cache to see the updated demo page).

Are you getting any errors at all?

from choices.

jshjohnson avatar jshjohnson commented on April 28, 2024

Looking back at your code: you're assigning this.props and the callback to an empty object which is not passed to Choices. It seems you're only passing this.props?

from choices.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.