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

Intializing table in GWTP - best practics #19

Closed
hacker-cb opened this issue Nov 16, 2016 · 4 comments
Closed

Intializing table in GWTP - best practics #19

hacker-cb opened this issue Nov 16, 2016 · 4 comments

Comments

@hacker-cb
Copy link
Contributor

In all examples table is initialized inside Composite widget in onLoad().
I'm using GWTP and I have tried to initialize table inisde View constructor but failed because widget is not attached to DOM in this time.
Which is the better place to initialize table inside GWTP view if I don't want to create Composite widget for each table?

@BenDol
Copy link
Contributor

BenDol commented Nov 16, 2016

If I remember correctly a GWTP view has an onAttached method that is called when the View is attached.

Verified here: https://github.com/ArcBees/GWTP/blob/master/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/client/ViewImpl.java#L188

@BenDol BenDol closed this as completed Nov 16, 2016
@hacker-cb
Copy link
Contributor Author

You are right, but onAttach() method is called every time presenter will be put to slot.
So in this case I need do something like:

...
private boolean initDone=false;
...
protected void onAttach(){
   if (initDone) return;
   ...
   table.addColumn(...);
   initDone=true;
}

Seems that it is not looks nice...

@BenDol
Copy link
Contributor

BenDol commented Nov 16, 2016

I will consider making it possible to initialize the table before the DOM has been attached. Will look into that over the next few days.

@BenDol BenDol reopened this Nov 16, 2016
@BenDol BenDol self-assigned this Nov 16, 2016
BenDol added a commit that referenced this issue Jul 28, 2017
Will be testing in a number of use cases to ensure nothing has broken.
@BenDol BenDol added the ready label Jul 28, 2017
@BenDol
Copy link
Contributor

BenDol commented Jul 31, 2017

Fixes are in the latest SNAPSHOT and the rc6

@BenDol BenDol closed this as completed Jul 31, 2017
@BenDol BenDol added this to the 2.0 milestone Jul 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants