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

Scrolls don't appear when content is inserted #85

Open
roman-gula opened this issue Aug 29, 2017 · 5 comments
Open

Scrolls don't appear when content is inserted #85

roman-gula opened this issue Aug 29, 2017 · 5 comments

Comments

@roman-gula
Copy link

roman-gula commented Aug 29, 2017

For example when using ajax to get some text.

component.js:

$.get({
	url: 'http://server.com/get-text',
	dataType: 'text'
}).then(data => {
	this.set('text', data)
});

component.hbs:

{{#ember-scrollable horizontal=true vertical=true}}{{text}}{{/ember-scrollable}}

It is necessary to wrap ember-scrollable into {{#if text}}{{/if}}.

@billdami
Copy link

billdami commented Sep 6, 2017

I've also noticed this, but in the other direction as well, namely, the scroll bar is not removed, or its height is not changed, when content is removed such that the ember-scrollable container should no longer scroll, or doesnt need to scroll as much.

Basically, any interactions/modifications that cause a change in the scroll content dimensions other than a window resize doesn't trigger a scroll size recalculation.

While not ideal, this issue could probably be mitigated by having some sort of imperative action/event that is sent to the component to force a scroll recalculation, is there any way to do this currently?

@alexander-alvarez
Copy link
Contributor

@billdami
Copy link

billdami commented Sep 6, 2017

@alexander-alvarez thanks for the response on this. I was able to actually solve my immediate use case roughly how you suggested, I used the actionReceiver property exposed by ember-component-inbound-actions, and fire the recalculate action in my parent controller with it, and it seems to work as expected:

{{#ember-scrollable actionReceiver=myScrollable}}...{{/ember-scrollable}}
myContentDidChange: observer('myContent', function() {
  this.get('myScrollable').send('recalculate');
})

@billdami
Copy link

billdami commented Sep 6, 2017

^ This might be something worth mentioning in the docs too

@westd
Copy link

westd commented Dec 10, 2018

i'm finding that set height="auto" and using flexbox to size the table to full available height results in a blank content. It looks like the twiddle posted above has the same problem, there is no content visible? https://ember-twiddle.com/071a58e410a17c64b8a0eee205d6be44?openFiles=templates.application.hbs%2C

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

4 participants