Giter Club home page Giter Club logo

Comments (4)

jquense avatar jquense commented on May 12, 2024

I have gone back and forth on splitting the callbacks. I may add a keyDown, or press or something in the future to capture typing. One issue is that it is hard to tell when a user is "done" typing, We should probably add an onSelect handler for when the value is selected from a list vs typing something...

In the meantime, you can effectively achieve what you are looking for in your onChange handler. The terms "intermediate" and "final" are a bit misleading, because all typed values in a combobox are valid as "final" values; i.e. you can select values that are not in the data list.

If your data prop is an array of objects { id: 0: name "james" } you can just check whether the onChange handler returned a string or an object. the instance of the value object will be returned when it is a value in the list.

function onChange(value){
   if ( typeof value === 'string' ) //value is not in the list
}

If your data array is an Array of strings, than you can just check whether the value is in the data list. You can also use this method for the above case as well.

function onChange(value){
   if ( data.indexOf(value) === -1 ) //value is not in the list
}

from react-widgets.

jquense avatar jquense commented on May 12, 2024

the more I think about this I am also convinced that there should be a onSelect handler for dropdowns and comboboxes...I may see if I can get to that this weekend

from react-widgets.

dlwalsh avatar dlwalsh commented on May 12, 2024

Thanks for the response @jquense.

Using an if statement to detect a match is the way I'm doing it currently. But I see two problems with this approach:
a) It may produce a false match. e.g. A list containing "Apple" and "Apple Pie".
b) The Combobox widget still stays open at this point.

An onSelect handler would be awesome.

from react-widgets.

dlwalsh avatar dlwalsh commented on May 12, 2024

Thank you @jquense.

from react-widgets.

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.