Comments (5)
Hi,
this isn't currently possible, do you have an example of why you'd need this over getting the object from your existing items with the key? It would be slight convenience but I don't think it's necessary.
from react-native-sectioned-multi-select.
Hi,
I fetch my data from remote API with following sample structure :
const items = [ { name: "Fruits", id: 0, children: [{ name: "Apple", id: 10, },{ name: "Strawberry", id: 17, },{ name: "Pineapple", id: 13, },{ name: "Banana", id: 14, },{ name: "Watermelon", id: 15, },{ name: "Kiwi fruit", id: 16, }] }, { name: "Gems", id: 1, children: [{ name: "Quartz", id: 20, },{ name: "Zircon", id: 21, },{ name: "Sapphire", id: 22, },{ name: "Topaz", id: 23, }] }, { name: "Plants", id: 2, children: [{ name: "Mother In Law\'s Tongue", id: 30, },{ name: "Yucca", id: 31, },{ name: "Monsteria", id: 32, },{ name: "Palm", id: 33, }] }, ]
Today if i select two elements, (Monsteria, Palm for example) i will have an selectedItems state array with two ID s
[32,33].
My need is to have an array with the full object with id 32 and 33 👍
[{
name: "Monsteria",
id: 32,
},{
name: "Palm",
id: 33,
}]
I don't want to make an other request to API to get the full object to build a new array
Maybe i can filter on items and rebuild the object array but i can't find a good way to do this
from react-native-sectioned-multi-select.
Hi @iCodePup, if you have a look at the dev branch I've added the prop onSelectedItemObjectsChange
. This is a function that returns the objects. (The main onSelectedItemsChange function still needs to be present).
The only caveat is that the parent items' child items will be contained in that object (as you get the object back exactly as it is) even though they aren't selected. Although I think it's clear that the top level objects are the selected ones.
Let me know if this works for you.
from react-native-sectioned-multi-select.
Hey ! Thanks 👍
It does the job but unfortunately onSelectedItemObjectsChange props seems to works for multiple select only .
It will be never call for single :(
from react-native-sectioned-multi-select.
@iCodePup thanks!
from react-native-sectioned-multi-select.
Related Issues (20)
- can i use this with expo? HOT 3
- Disable the entire control? HOT 2
- Separate parentSelectedItems and subSelectedItems HOT 4
- Styling the Overall Modal?
- onSelectedItemsChange the Model is getting closed HOT 2
- display more level subItem HOT 2
- Disable backdrop HOT 1
- Disabled items getting removed HOT 2
- Expand dropdown function? HOT 4
- How to hide keyboard during search? HOT 3
- Hide the list of options until user enters a search item HOT 2
- How can you limit items selected while still allowing items to be deselected after the maxItems has been reached? HOT 2
- Checkmark is not visible when an item is selected HOT 8
- How is selectedItems supposed to work? HOT 3
- README.md IconRenderer Typo HOT 4
- Request: Styles Image Labeling ? HOT 3
- Add multiple display keys HOT 5
- Cancel Button does NOT Apprear Correctly on iOS HOT 4
- Adding Accessibility Labels HOT 5
- Display the component in a row along with other components HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-sectioned-multi-select.