View Full Version : Get all the values from a selected row on a grid?

30 Oct 2011, 2:56 AM
Get all the values from a selected row on a grid?

I am using GXt GWt and am trying to get the values from a selected row in a tree grid, but can't seem to get it working..

E.g. if the user clicks row, i want to be able to get the values for all the columns in that row.

cm =newColumnModel(createColumnConfig());

// Create grids based on data (held in stores), and attach listeners for when a row is clicked
finalTreeGrid<Build> nightlyResultsGrid = createTreeGrid(nightlyResultsStore);

publicvoid handleEvent(BaseEvent clickEvent)
GridEvent gridEvent =(GridEvent)clickEvent;

}The code above keeps generating an exception..
15:58:09.861 [ERROR] [dashboard] Uncaught exception escaped java.lang.NullPointerException: null at com.rory.mep.ui.metrics.client.UserInterface$3.handleEvent(UserInterface.java:109) at com.extjs.gxt.ui.client.event.BaseObservable.callListener(BaseObservable.java:178) at com.extjs.gxt.ui.client.event.BaseObservable.fireEvent(BaseObservable.java:86) at com.extjs.gxt.ui.client.widget.Component.fireEvent(Component.java:456) at com.extjs.gxt.ui.client.widget.grid.Grid.onClick(Grid.java:811) at com.extjs.gxt.ui.client.widget.treegrid.TreeGrid.onClick(TreeGrid.java:745)
Any help is much appreciated.

30 Oct 2011, 3:19 AM
The NPE gets thrown in your code. Probably one of your get("dataindex" calls returns null and so you cannot call toString on it

31 Oct 2011, 3:32 AM
Thanks Sven.

I was using the column heading text instead of the column id

31 Oct 2011, 5:51 AM
@Rory7902 Please do not post the same thing over and over in different forums. I have cleaned up all your duplicates.