Skip to content

Fix blank table after switching routes#30

Merged
ppong merged 1 commit intoAddepar:masterfrom
alexspeller:fix-blank-table-after-route-switching
Feb 28, 2013
Merged

Fix blank table after switching routes#30
ppong merged 1 commit intoAddepar:masterfrom
alexspeller:fix-blank-table-after-route-switching

Conversation

@alexspeller
Copy link
Copy Markdown
Contributor

This fixes a bug causing a blank gray table after switching routes. This only manifests when the table is scrolled from the top, and then you switch to a different route that removes the table and then switch back again and the table is re-inserted. In this case the controller caches the scroll top and causes the whole body of the table to be blank until the table is scrolled.

ppong pushed a commit that referenced this pull request Feb 28, 2013
…witching

Fix blank table after switching routes
@ppong ppong merged commit d4fb9bb into Addepar:master Feb 28, 2013
@ppong
Copy link
Copy Markdown
Contributor

ppong commented Feb 28, 2013

thanks @alexspeller. Merged

@alexspeller alexspeller deleted the fix-blank-table-after-route-switching branch February 28, 2013 19:50
@joemoss
Copy link
Copy Markdown

joemoss commented Sep 26, 2013

@alexspeller @ppong We are still seeing this problem using the latest builds, especially in tables with only a few rows of data. We can force the table to "re-render" after route changes if we manually add this code to Ember.Table.TablesContainer:

didInsertElement: function () {
this._super(); // Call line 17 in views.js

    // Hacky Fix
    $('.body-container').scrollTop($('.body-container')[0].scrollHeight);
    setTimeout(function () {
        $('.body-container').scrollTop(0);
    }, 0);

}

Are you seeing this behavior still too?

@joemoss
Copy link
Copy Markdown

joemoss commented Oct 11, 2013

@alexspeller @ppong This issue should be reopened!

If you render a table, transition to another route, then transition back into the table, the "content" property does not change, and the table rows do not render again. (You see a blank gray table.)

In controllers.coffee, line 218, the method bodyContent observes the "content" property. This is not enough. We added a simple "refire" property which is incremented when the TableContainer is inserted (didInsertElement).

This forces the table rows to re-render. This is not the ideal solution, but it's a step in the right direction.

@jasonmit
Copy link
Copy Markdown

I'm also running into the same issue. My hack was inside of setupController

Ember.run.next(function() {
controller.propertyDidChange('content');
});

@alexspeller
Copy link
Copy Markdown
Contributor Author

@ppong this should probably be reopened. It may be due to view reuse when only the model of a route changes (but not the route itself), although this is speculation.

@bengillies I wouldn't be surprised if you hit this at some point

@bengillies
Copy link
Copy Markdown

@alexspeller yep, came across this yesterday. Can confirm it still exists as an issue.

@sladwig
Copy link
Copy Markdown

sladwig commented Dec 12, 2013

+1

billy-addepar added a commit that referenced this pull request Sep 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

6 participants