I have a problem with a grouping grid and I do not know how to fix it. I am creating a grid which has a grouping view associated. The problem is that I receive the following NPE:
[ERROR] Uncaught exception escaped
java.lang.NullPointerException: null
at com.extjs.gxt.ui.client.widget.grid.GridView.renderUI(GridView.java:1564)
at com.extjs.gxt.ui.client.widget.grid.GridView.render(GridView.java:1520)
at com.extjs.gxt.ui.client.widget.grid.Grid.afterRender(Grid.java:610)
at com.extjs.gxt.ui.client.widget.Component.render(Component.java:961)
The problem is that the templates member of the GroupingView class is not properly initialized. I walked the code a little bit and I noticed that the method
doesn't do what it is supposed to do, leaving the templates member uninitialized.
I searched the forum for a response, but the compiler trick (using the same java version both in Eclipse and in the JAVA_HOME variable) doesn't work. I am using JDK version 1.6.0_10.
This forum needs your help: you got hints from the community and now you have fixed your code? dont just reply with "now its fixed" or "i found the error"! please take the time to post also an detailed answer with the working code.
why the template files are only in the gxt.jar and not in the src?
This forum needs your help: you got hints from the community and now you have fixed your code? dont just reply with "now its fixed" or "i found the error"! please take the time to post also an detailed answer with the working code.
The template files that are needed are contained within gxt.jar (GridTemplates#body.html, etc - one for each method of the GridTemplates pseudo-interface) - also in my gxt.jar (standard, from the Download section).
I have also read all the mentioned threads and tried the given solutions before opening this one. The template files are in place, the java compiler seems to be ok... I do not have any clues about what the problem might be.
and the compiler dont output some warnings or errors?
This forum needs your help: you got hints from the community and now you have fixed your code? dont just reply with "now its fixed" or "i found the error"! please take the time to post also an detailed answer with the working code.
Ok, the problem is solved. However, this is a little bit confusing: the reason for that exception (and for the inability to load the templates) is that the GroupingView was created and assigned to the grid in the grid's onRender() method. Is this how it should work? Is this documented somehow?
can you please explain HOW you have solved it? pls also with a code snippet.
This forum needs your help: you got hints from the community and now you have fixed your code? dont just reply with "now its fixed" or "i found the error"! please take the time to post also an detailed answer with the working code.
I think it is quite self-explaining: I've moved the creation of the GroupingView from the onRender() method to the constructor. I cannot give code-snippets because this is part of a large application.
but there was no hint about moving the creation of GroupingView to an other place
also because there was no code how you have done this creation before you solved the problem, no info that you have created the grouping view in an overwritten onRender. pls compare: in this example the grouping view also not created in onRender http://www.extjs.com/examples/explorer.html#grouping
and i was thinking you point to this line in onRender "view.init(this);" when you described it with this text "GroupingView was created and assigned to the grid in the grid's onRender() method")
sorry, but your text without small code snippets is not that much self explainig ;-)
but thanks for detailed description of your solution :-)
This forum needs your help: you got hints from the community and now you have fixed your code? dont just reply with "now its fixed" or "i found the error"! please take the time to post also an detailed answer with the working code.