sukima / ember-cli-select-picker

An enhanced Boostrap styled select component addon for Ember CLI
https://sukima.github.io/ember-cli-select-picker
MIT License
23 stars 15 forks source link

How to retrieve the list of checked items from the controller? #28

Closed vitasiku closed 8 years ago

vitasiku commented 9 years ago

I have followed the dummy example test-select-picker but can't seem to make it work. Here is my observer in the controller. I am not an expert in ember components and thanks in advance.

multipleValueChanged: function(){
   console.log("get the list of checked items here"); 
}.observes('multipleValue')
sukima commented 9 years ago

The select picker doesn't use any properties called multipleValue Is this a bound property?

If so then your observer probably needs to be multipleValue.@each so that changes to the selection (which is a collection) are captured as well. http://guides.emberjs.com/v1.10.0/object-model/computed-properties-and-aggregate-data/

vitasiku commented 9 years ago

Yes, `multipleValue is bound to selection property. However, I have been getting the following error before and after following your suggestion above Error while processing route: test-select-picker (intermediate value).observes is not a function I am following the example here!. Put differently, would you include an example to show how to use the selected values from a controller as part of the documentation? Thanks

sukima commented 9 years ago

You linked to the dummy application So I'm curious are you experiencing this error in your own application or in a modified version of the dummy app (as in during tests on a fork of the project)?

This really feels like prototype extensions are disabled which is true in the ember-cli-select-picker repo because it is an addon and all addons have it turned off. However a normal application (created with ember new app-name) by default has that turned on.

The dummy app is specific for testing and is not an example on how to use this addon. For a good example how to use it look at my sample ember app used on the main website.

Without seeing your code I can not help further other then suggesting to try the alternative form for declaring observers as outlined in the docs:

multipleValueChanged: Ember.observer('multipleValue', function(){
   console.log("get the list of checked items here"); 
})
sukima commented 8 years ago

Closing due to atrophy. Reopen if needed.