Document how to use POJO's with power-select
See original GitHub issueThe documentation is kind of vague about this. It says:
The component compares the selected option with the options in the collection by equality, so when working with POJOs bear in mind that { foo: 'bar' } === { foo: 'bar' } is false.
It’s quite a common use case where your options
is something like: [{display: 'Hello', value: 1}, {display: 'Sup', value: 2}]
, and your selected
is the value of the value
key (i.e 1
or 2
).
Is there a way to say 'compare selected
with key x
? Does power-select not support this at all?
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
MongoDB Driver Quick Start - POJOs - GitHub Pages
To delete documents from a collection, you can use the collection's deleteOne and deleteMany methods. Pass to the methods a filter object to...
Read more >Mapping Documents to POJOs with the MongoDB Java Driver
Developer Advocates Maxime Beugnet and Nic Raboy show you how to automatically map MongoDB documents to Plain Old Java Objects ( POJOs )...
Read more >Document Data Format: POJOs — Java Sync - MongoDB
In this guide, you can learn how to store and retrieve data in the MongoDB Java driver using plain old Java objects (POJOs...
Read more >Products A to Z - SS&C Technologies
View an alphabetic listing of all SS&C products, services, and solutions with links to more information about each.
Read more >POJOs - jOOQ
You can use your own. See the manual's section about POJOs with custom RecordMappers to see how to modify jOOQ's standard POJO mapping...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I doesn’t support it, but it’s intentional. The
selected
has to be, by design, one option of the list, or have it’s same shape.But it’s not supported because it’s trivial to do by the user, by with a computed property or, my favourite option, using the
find-by
helper fromember-composable-helpers
.I find the example above very explicit. In your context you only care about one value, that perhaps happens to be a query parameter or something. But to the component you pass the record with that ID or value.
I’d love if the snippet above was in the docs. Over the years I’ve tried again and again to see if I could use
power-select
without needing a separate action on the controller/computed property/some extra state management forselected
, and I always gave up on it.It wasn’t until today I saw this comment and can finally understood the syntax for passing in the currently selected option to the
mut
handler. Thevalue=<path>
syntax still feels a bit like magic to me and I’ve never really understood that syntax as described in the ember docs forModifying the action's first parameter
. I always thought thevalue=""
worked by pulling data from the underlying JS event and I’m not totally clear why it works here as described, but it does!On closer inspection, I either continually missed this from the Ember docs or never understood it fully until now
Either way, I’m finally able to get rid of the convoluted wrapper component I had made around
power-select
thanks to seeing a working example ofvalue="value"
here today. Though, for my underlying list of objects, my solution wasvalue="name"
since that’s how my relevant array data ids were assigned