Question

Given these codes:

private ListDataProvider<String> cellListDataProvider = new ListDataProvider<String>();
public void onLoadingData(){
    mySimplePager.setDisplay(myCellList);
    mySimplePager.setPageSize(3);
    cellListDataProvider.addDataDisplay(myCellList);
}

//There is a button & when clicking that button , it will call
public void resetData(){
   cellListDataProvider.getList().clear();
   mySimplePager.setPageSize(0); ///--> dot no help
}

Now after calling resetData() then the CellList was disappeared, but the SimplePager still shows the text 1-1 of 0, which doesn't make any sense. I tried to clear that text by using mySimplePager.setPageSize(0); but nothing happened unless I refresh the page.

So How to clear the Text "1-1 of 0" in SimplePager (GWT)?

Was it helpful?

Solution

What I did is just to set the pager visibility to false when the count is 0, it will hide the whole pager.

OTHER TIPS

Try

mySimplePager.getDisplay().setRowCount(0);

create your own pager.

import com.google.gwt.user.cellview.client.SimplePager;

public class NormalPager extends SimplePager{

      protected String createText() {
          if(getDisplay().getRowCount()==0){
                return "0 of 0";
            }else{
                return super.createText();
            }
          }   
}

because simple pager label come from range.getStart() + 1; and can't set minus value on range.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top