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

AbstractDataTable onLoad() makes for difficult initialization #11

Closed
chinshaw opened this issue Oct 7, 2016 · 6 comments
Closed

AbstractDataTable onLoad() makes for difficult initialization #11

chinshaw opened this issue Oct 7, 2016 · 6 comments

Comments

@chinshaw
Copy link

chinshaw commented Oct 7, 2016

It looks like the onLoad sets the the boolean setup to true. I think this should probably be moved to the public void setup(TableScaffolding scaffolding) method. The problem I am having is that I am trying to configure the table before it is loaded into the view. The issue is that I am getting a null pointer exception when trying to add the first header. I traced this back to the onLoad method not being called without it being added to the dom. If the boolean isSetup was assigned true in the setup(TableScaffolding scaffolding) method I would be able to call setup with the default table scaffolding and the onload event would not run when the table is loaded but with the logic the way it is. If I call setup and then the onLoad event is called the setup will be called twice.

@chinshaw chinshaw changed the title AbstractDataTable onLoadEvent makes for difficult initialization AbstractDataTable onLoad() makes for difficult initialization Oct 7, 2016
@BenDol
Copy link
Contributor

BenDol commented Nov 2, 2016

Can you provide an example of what you are trying to accomplish, I will revise it based on the use case you require if it is better. Thanks!

@tbenbrahim
Copy link

I have something like that (create columns in constructor, not in onLoad event)

https://gist.github.com/tbenbrahim/d718ff239e47adc5a5a95d879864f8a4

@BenDol
Copy link
Contributor

BenDol commented Feb 7, 2017

I added a load callback for the time being, that will ensure the table is attached and loaded table.setLoadedCallback(...)

@tbenbrahim
Copy link

I think the problem is having to know where to put code. I just spent an hour debugging why a row select event handler was not firing, I guess you have to know to call 'addRowSelectHandler` in onLoad and not right after you construct the table. I am trying to get rid of all those cases... This one would be easy, as there is no need to use jQuery events.

@BenDol
Copy link
Contributor

BenDol commented Feb 7, 2017

Yep the loading will be reworked to fix those use cases.

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

3 participants