ember-cli-selectize
ember-cli-selectize copied to clipboard
Value and/or selection set to null on tear down.
I am running into issues when the content changes during tear down of the component. It appears the _onItemRemove
function is being called thus setting the value to null. I think moving to the data down actions up methodology will fix this problem.
So before I attempt this I thought I would ask how should this work?
I feel this component should two way bind a value as well a support ddau
. I am thinking the value
property should be a two way binding and selection
a one way binding.
So one can either use the value
property or the selection
property with the select-item
action.
Is this a good approach?
So this issue is not happing on tear down it is happening when ember data saves a object with associations. For instance I have a Task
that belongs to a Person
. Using this component you can choose the Person
.
When saving the Task
ember data removes and then re adds the person. ember-cli-selectize
then decides that the person is not in the list and sets the person attribute to null using the following callback _onItemRemove
This is strange. I'm using this component with Ember Data and didn't have any problems.
Please tell us some more info, like the template you're using, etc.
When saving the Task ember data removes and then re adds the person.
This part makes me confused. Is it because your backend isn't returning the association? Is the person really associated after save or is it null?
@miguelcobain yes when saving the Task the server responds with the associations side loaded. I am not sure what the template is.
@arenoir I was experiencing the same issues, but my problem was, that I've specified value & selection to the property:
value=value
selection=value
and it caused random results )
Hey! Having the same issue here... I have a CRUD for a model. First time the page renders, everything works awesome as expected, then I go back to index and the back to the same route and BAM, my selections (model.myProperty) became null :/
Any idea?
Please give us some details like the template you're using. It's working fine here.
I have this issue when the following happens:
- Set content and selection
- Set content to
[]
(ember-data does this by some reason) -
selection
becomes null - Set content to some non-empty array
-
selection
is still null
This is due to how selectize works. Basically the possible options become non-existing, and selectize assumes that the current options was deselected, thus the selection
is set to null.
Solutions are welcome.
@miguelcobain I have transitioned to a DDAU approach. It is not ideal but at least I can prevent the mutation in the select-item
action.
I think a completely ember select component is needed. I started a addon its a start and would appreciate your input.
@arenoir @miguelcobain indeed, Ember 2.x road will be all about DDAU, I think there's a lot of stuff to do on ember-cli-selectize in order to be fully compatible with it (and error free)
@arenoir Maybe we should join forces: https://github.com/miguelcobain/ember-select