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

Fixtable-grid fails to render if using row selection and data is not set at render #82

Closed
smargovsky opened this issue Feb 1, 2017 · 2 comments
Labels

Comments

@smargovsky
Copy link
Contributor

resetSelection: Ember.observer('visibleContent.[]', function fixtableGrid$resetSelection() {
    if (!this.get('rowSelection')) { return; }

    let selectedRows = Ember.Object.create();
    this.set('selectedRows', selectedRows);
    this.get('visibleContent').forEach((row, rowIndex) => {
      selectedRows.set(rowIndex.toString(), false);
    });

This forEach fails ungracefully when data is not set at render time. Setting the data to an empty array fixes this, though this behavior is inconsistent with the same table without row selection.

@menewman menewman added the bug label Feb 8, 2017
@menewman
Copy link
Contributor

menewman commented Feb 8, 2017

@smargovsky, looking at this code a little more closely, I'd expect this forEach to be fine because visibleContent should compute to an empty array if content hasn't been set on the fixtable-grid yet. When you say "when data is not set at render time," what specifically does that mean? Can we reproduce this in a relatively simple environment (e.g., the dummy app)?

Obviously we can just not loop over visibleContent if it doesn't exist, but I wonder if this is actually caused by calling this function at the wrong point in the component lifecycle or something.

@smargovsky
Copy link
Contributor Author

So, attempts to reproduce this behavior in the dummy app have fabulously failed. Closing until further notice, thanks @menewman.

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

No branches or pull requests

2 participants