Comments (16)
Currently not possible, but definitely doable!
from ember-cli-selectize.
I got the same problem from switching a plain select to selectize... :/
from ember-cli-selectize.
This is a top priority.
from ember-cli-selectize.
Maybe I'm not understanding, but this works for me saving the US State on an account object. state
is just a string field on account. states
is an array of strings:
{{ember-selectize
content=states
optionValuePath="content"
optionLabelPath="content"
selection=account.state
placeholder="Select State" }}
from ember-cli-selectize.
Yes this works, but not if states is an array of objects of which you only want to select a property as value.
For example states is an array of objects with an property "name" which is a string. Then you wouldn't be able to bind the variable to the name, it would bind to the whole object.
from ember-cli-selectize.
@davekaro didn't occur to me passing just content
to optionValuePath
. Nice.
@topaxi, conceptually that makes sense to me.
A selection
must be an element of content
.
In the example you gave, what would be expected? To bind optionLabelPath
to the selection? It's weird.
Could you post an example of Ember.Select that would do what you expect?
It would be easier for us to understand.
from ember-cli-selectize.
I'm using a bound query param to filter a result set. This means, the parameter is only the id, not an whole object.
{{view 'select'
prompt = 'Filter customer'
id = 'customer'
class = 'form-control'
content = customers
value = customerId
optionLabelPath = 'content.name'
optionValuePath = 'content.id'
}}
I expected that I could just swap view 'select' with ember-selectize but this didn't work out.
I guess the value path should bind to the selection (or value in case of single value selections?), like the Ember.Select view.
It was quite simple to switch out select views which selected whole objects though 👍
from ember-cli-selectize.
I think I nailed the problem.
After reading the docs it seems that Ember.Select provides both value
and selection
bindings.
selection
will have the selected object. value
will have the selected value.
We currently only support selection
. So, I'm assuming that adding support for value
would be enough to cover your use case, right?
from ember-cli-selectize.
Yes that would totally cover my case, not sure about @salzhrani though.
from ember-cli-selectize.
I agree
from ember-cli-selectize.
@topaxi Any idea on what happens to value
when selection is multiple?
from ember-cli-selectize.
Quoting Ember Select source:
In single selection mode (when
multiple
isfalse
), value can be used to
get the current selection's value or set the selection by it's value.
It is not currently supported in multiple selection mode.
from ember-cli-selectize.
It seems to be an array though: http://emberjs.jsbin.com/hovonohude/1/
from ember-cli-selectize.
But in any case, single value solves our issue and covers the official ember documentation so i guess it should be fine :)
from ember-cli-selectize.
Updated to 0.0.11
.
This should be working for single values. Just bind value
property.
Also, the default valuePath and labelPath are now content
, so this:
becomes this
@topaxi
On a side note, I looked through Ember Select source code and couldn't find how that JSBin happens. o.O
from ember-cli-selectize.
very nice thanks a lot! :)
from ember-cli-selectize.
Related Issues (20)
- hideSelected and multiple don't work together HOT 1
- v0.5.8 broke the selectize styles HOT 4
- selectize.js:2151 Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'
- multiple mode bug? HOT 2
- Selectize changing my model property to null
- Best Practice for adding/removing on a REST/API error
- add 'readOnly' to 'generalOptions ' HOT 2
- Move selectize and sifter from Bower to NPM HOT 3
- select-item action should not fire when selection promise resolves. HOT 1
- Using multiple=true with ember-changeset-validations HOT 3
- Add Support for data-dash-attributes
- Can't install due to missing dependency HOT 1
- Label truncates when second word contains letters in the first in multiple mode HOT 1
- Tooltip for list
- 2 selectors in the same template and options visible for both of them at the same time HOT 1
- Fix breaking changes in FastBoot 1.0 HOT 1
- Migration to power select HOT 1
- DEPRECATION HOT 1
- Deprecated calls to sendAction
- ember-cli-selectize triggers a Maximum Call Stack exceeded errors
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 ember-cli-selectize.