GithubHelp home page GithubHelp logo

Comments (4)

Aidurber avatar Aidurber commented on August 20, 2024

@Puneetbh I'll need an example, I don't get what you mean.

from react-picky.

Puneetbh avatar Puneetbh commented on August 20, 2024

@Aidurber I have array of objects and with loop i am displaying react-picky dropdown by passing options, now i am passing common generic onchange method to in onChange property, inside that i want to know which dropdon valud changed so i can update state accordingly

Like if country changed by user i want to know user changed country then i will update state of country so want to get some additional data whenever user making selection in dropdown
Basically i want to know which dropdon onChange method invoked

from react-picky.

Puneetbh avatar Puneetbh commented on August 20, 2024

@Aidurber i got the solution, Thanks

from react-picky.

priyankaviswan avatar priyankaviswan commented on August 20, 2024

Hi Aidurber,

I have recently downloaded the picky and have used it inside a map function to loop through my dynamic data. In the picky i have set multiselect as true.
How ever on the onchange function am getting only the currently selected value and not the list of values selected for picky.

This is the sample code:
{
sectorsData.map((selectItem, i) => (

))}
in the on change function i have written the following code :
const selectedOption = (name,value) =>{
setAssetsAddedState(prev => { return { ...prev, [name] : value}});
}
The issue am facing is in the case of multiselect where the value will be a single object containing the current selected item rather than the list of items selected. Could you please help me with the issue. I have tried every possible solution and it does not seem to work.Any help would be really appreciated as am stuck in the issue for sometime.
Where a sample sectorsData:
[
{
"name": "Technology",
"options": [
{ "id": "1",
"name": "AI & Analytics"
},
{
"id": "2",
"name": "Robotics"
},
{
"id": "3",
"name": "IoT"
}
]
},
{
"name": "Sector",
"options": [
{
"id": "1",
"name": "Automotive"
},
{
"id": "2",
"name": "Oil and gas"
}
]
}
]

from react-picky.

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.