Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
-
None
Description
If you define the Table control as public, Click will automatically add this Control. So it will call table.setContext() .
The table.setContext() should set the Context in the "pageLink" control.
But at this time, the page Link is null, because we don't called the table.setPageSize() method.
So, this code throws a NPE. A possible fix for this, is change the setPageSize to also set the context in the ActionLink control.
---------------------------------------------------
public class PersonTablePage extends BasePage {
public Table table = new Table("table");
public PersonTablePage()
{ table.setAttribute("class","simple"); table.addColumn(new Column("id")); table.addColumn(new Column("name")); table.addColumn(new Column("email")); table.addColumn(new Column("birthday")); //It works here // table.setPageSize(3); }public void onInit()
{ //This will throw a NPE table.setPageSize(3); }public void onGet()
{ table.setRowList(getPersonService().getAll()); }}