Trigger Grid AutoExpand?
I'm currently using GWT-P which allows our app to remember a state in which you left a view. I believe it only builds the view from scratch the very first time its entered. After that it just redisplays it.
I have a column in the grid thats set to autoexpand: grid.getView().setAutoExpandColumn(name);
The very first time I enter the screen it looks great. If I transition to a new place, then go back to the page with the grid, the column is shrunk down to a minimum size and doesn't get autoexpanded.
I'm ok with having to manually retrigger this at each new visit to the page, but how do I trigger the event?
I apologize in advance if this is super easy to find somewhere.
Well..as I've done before this post was about 1 minute premature. I had tried all kinds of things and after I posted this got the idea to look for grid.getView().layout() and that did it.
You can delete this thread if need be, sorry about that.
No need to delete - between the forum search functionality and search engines indexing the site, we love to see stories that end well, whether people find their own solutions or get help from others.
That said, this sounds like it could be a bug that you have to trigger this at all - can you describe in a little more detail the case where this is happening or provide a test sample so we can investigate if it is actually a bug?
Sure, we're using a GWT extension called GWT-Platform. We're using this extension for several different reasons most of which you can get from reading the documentation for it; LINK.
Through out our application we take several different components in different places that all have their own individual MVP structure and combine them to make a single place. For instance our admin page has 4 slots in which we can insert other modules to form our admin page. The modules we fill those slots with are the header, a top toolbar, a left toolbar, and a content area. Each of these modules have their own MVP places that handle their own server calls.
When one of these places gets rendered for the first time in a session, the app is never again completely rebuilt. It's constructor is called a single time during one session. Each models view is built on its first entrance and then every revisit going forward it just gets reset (not rebuilt). In our case we just use the onReset method to clear our fields. For example if we have a grid on a search page, we just clear the store on reset and then call the server to repopulate it for the next visit. We don't necessarily need to pull on every revisit but considering we're writing a cloud application and data could get stale, we repopulate every new visit.
I'd imagine that GWT/GXT has their grids call the autoexpand when they first render. Well as I stated above they only get built once, so any time we revisit a page that has already been built our autoexpand column actually gets autoexpanded in the other direction. Instead of filling the remaining space it shrinks. So I'm now calling grid.getView().layout in our onReset methods so that it triggers that autoexpand to occur.