Closed hchoong closed 9 years ago
Insert is working for FlexScrollView but not for LayoutController. Can you suggest which way is better?
Hmm, that's weird.
Just wondering, have you tried ensureVisible(..)
on the newly inserted surface. Does that fix your problem?
EDIT: Ignore that completely, LayoutController doesn't have 'ensureVisible', I was a bit tipsy when I wrote that last night.
ensureVisible(..)
is only available for ScrollController. It doesn't work with LayoutController.
I will use ScrollController and disable the scroll.
Hey Howard,
I know what the problem is. The layout-controller doesn't change the "first visible node" when you insert a node. Using ScrollController is an option, but do note that when you "insert" before the first visible node, it doesn't necessarily show that node. If you want to ensure that the node is visible also call ensureVisible
on ScrollController.
An other option would be to to reset the whole datasource of the layoutcontroller, this way it will always render from the first node in the datasource:
layoutController.setDataSource([header,content]);
I like the latter option since flex controller will calls the layout function when I add/remove elements. This way I can ensure the correct elements rendered on the screen and the performance should be the same.
Awesome, glad to hear that's a suitable solution.
As for fixing this.. I've decided not to fix this in the current famous-flex version. Instead I will be focusing on the mixed-mode version and will take this issue into account when writing the new LayoutController.
cheers
I am trying to insert surface to the top of the layout, but the surface doesn't seem to be rendered. I checked the getDataSource() and the added surface is in the list, but not rendered on the screen.
Sample code I am using: