Change Grid Header Name

So from the tutorial we have a grid with “First Name”, “Last Name” and so on as grid column hader name. The question is, how exactly, I can rename them?

I have tried things like:

grid.getDefaultHeaderRow().getCell("firstName").setHtml("The <u>amount</u>");

or

grid.getColumn("First Name").setHeaderCaption("Name");

and so on.
And evry time I got NullPointerException .

As I understand, I didn’t pass right column name to the grid get?

Please Help!

You should use the following format.

grid.getColumn(“myPropertyName”).setHeaderCaption(“My Caption”);

The “myPropertyName” should match the getters and setters of the POJO / Bean which you use in the datasource container.

I.e. you should have this in your bean

bean.getMyPropertyName() { … }

I hope this clarifies the thing.