google-code-export / gwt-ext-ux

Automatically exported from code.google.com/p/gwt-ext-ux
1 stars 3 forks source link

The example "Grid with Local Paging" gives an error if the user doesn't use whole numbers #24

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Open the example Grid with Local Paging.
2. Enter something else than an integer in the page size, i.e. 7.2
3. Press enter

The expected output could be that the user isn't allowed to enter "." as 
with letters. Or add a check:

String sPageSize = field.getValueAsString());
int index = sPageSize.indexOf(".");
if (index>-1){
  if(index==0){
    int pageSize = 0;
  }
  else{
    int pageSize = Integer.parseInt(sPageSize.substring(0, index - 1));
  }
  pagingToolbar.setPageSize(pageSize); 
}

While doing a sollution I also noticed that the example also doesn't like 
when the user enters a "0".

Just add:

if (pageSize == 0) pageSize = 1;

Best regards
Christian Falck

Original issue reported on code.google.com by christia...@gmail.com on 2 Jun 2008 at 4:07