Widget won't load with Datagrid sorthandler

51 views
Skip to first unread message

RAJ

unread,
Aug 7, 2012, 9:22:44 AM8/7/12
to google-we...@googlegroups.com
Hi,

In my project, when I load only the composite with bare elements, it will load fine, but when I have the sorthandler defined for datgrid, the composite won't load at all. I have attached the code for entrypoint and composite.

If the constructor is changed only to have initwidget, then the composite will load fine.

I am using Eclipse Juno and GWT 2.5 rc1 on Windows 7, and testing on chrome.

Please suggest a solution.

Thanks.





FilePullEP.java
FileSelector.java

Fille

unread,
Aug 7, 2012, 9:52:45 AM8/7/12
to google-we...@googlegroups.com
Do you get any exceptions?

It seems that the problem is that you don't initialize dataGrid.

Use something like: 
@UiField(provided = true)
DataGrid<FileProperties> dataGrid;

And in constructor:

dataGrid = new DataGrid<FileProperties>(KEY_PROVIDER);


Jens

unread,
Aug 7, 2012, 9:53:00 AM8/7/12
to google-we...@googlegroups.com
Don't you get a NullPointerException? Your "dataGrid" variable should be null until you call initWidget(uiBinder.createAndBindUi(this)) which fills all the @UiField variables.

Rule of thumb: Access a @UiField after initWidget(uiBinder.createAndBindUi(this)) has been called and if you use @UiField(provided = true) initialize the variable yourself before initWidget(uiBinder.createAndBindUi(this)) is called.

-- J.

RAJ

unread,
Aug 7, 2012, 12:54:02 PM8/7/12
to google-we...@googlegroups.com
Thanks Jens and Fille.

That was the problem. I forgot to initialize the datagrid. Can't beleive how I missed that.

Thanks a ton for you help.

RAJ
Reply all
Reply to author
Forward
0 new messages