Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken after upgrade to ember-data 1.0.0-beta.14.1 #70

Open
tommyblue opened this issue Mar 2, 2015 · 2 comments
Open

Broken after upgrade to ember-data 1.0.0-beta.14.1 #70

tommyblue opened this issue Mar 2, 2015 · 2 comments

Comments

@tommyblue
Copy link

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

@tommyblue
Copy link
Author

@iStefo any feedback on this?

@jpaas
Copy link

jpaas commented Jun 2, 2015

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants