ember-select-2
ember-select-2 copied to clipboard
Broken after upgrade to ember-data 1.0.0-beta.14.1
After the upgrade to ember-data 1.0.0-beta.14.1 (1.0.0-beta.12) I get this error:
Uncaught TypeError: Cannot read property 'children' of undefined
at select-2.js:293
:
if (item.children && item.children.length) {
this is the template:
{{select-2
content=file.rootCategoryChildren
value=file.selectedChildCategory
multiple=false
placeholderTranslation="ui.inputs.placeholders.second-image-category"
optionValuePath="id"
optionLabelPath="name"
class="form-control"
enabled=file.isRootCategorySelected
}}
file.rootCategoryChildren
is initially null
, when another value is selected, it's populated.
This is the select-2 input which causes file.rootCategoryChildren
to be populated, which seems almost the same, but it works:
{{select-2
content=rootCategories
value=file.selectedRootCategory
multiple=false
placeholderTranslation="ui.inputs.placeholders.first-image-category"
optionValuePath="id"
optionLabelPath="name"
class="form-control"
}}
and this is the function which populates rootCategoryChildren
:
updateRootCategoryChildren: function() {
this.set(
'rootCategoryChildren',
this.get('controllers.colored-finished-products/images-upload')
.get('availableCategories')
.findBy('id', this.get('selectedRootCategory'))
.get('children')
);
this.set('selectedChildCategory', null);
}.observes('selectedRootCategory')
The original availableCategories
array comes from the backend, via DS.Model and a rails-api backend
@iStefo any feedback on this?
I'm also having this issue. Its because the models we have fetched have an attribute called 'children' which causes them to be misconstrued as having nested content. Is there any way to reconfigure this to tell it that either A. They don't have nested content or B. To use some other attribute name for children?