Fixtable-grid fails to render if using row selection and data is not set at render
Closed this issue · 2 comments
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.
@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.
So, attempts to reproduce this behavior in the dummy app have fabulously failed. Closing until further notice, thanks @menewman.