Display SimplePager Pagination menu both at the top and bottom of the data - gwt

I have some data that I'm displaying in a CellTable which is inside a SimplePager. The pagination navigation options are shown in the bottom, I was wondering if it would be possible to show these on the top as well as the bottom of the data.
I want to do this because depending on the browser size, the user may not be able to see the controls.
I want the navigation controls to show both before and after the table data.

Yes, just add two pagers:
final AbstractPager pager = new SimplePager();
pager.setDisplay(cellTable);
contentPanel.add(pager);
contentPanel.add(cellTable);
final AbstractPager pager2 = new SimplePager();
pager2.setDisplay(cellTable);
contentPanel.add(pager2);

The pager shows on top if you add pager before adding celltable in layout.
CellTable table=new CellTable();
VerticalPanel containerPanel = new VerticalPanel();
SimplePager pager1 = new SimplePager(TextLocation.CENTER);
containerPanel.add(pager);
containerPanel.add(table);
SimplePager pager2 = new SimplePager(TextLocation.CENTER)
containerPanel.add(pager2)
Thus, you have to create two pager and add celltable in between of those.

Related

GWT SimplePager - not displaying buttons

I have a DataGrid that I want to add pagination to. Following the example from the docs, I have:
dataProvider.addDataDisplay(resultsGrid);
// Create a Pager to control the table.
SimplePager.Resources pagerResources = GWT.create(SimplePager.Resources.class);
pager = new SimplePager(TextLocation.CENTER, pagerResources,true, 50, true);
pager.setDisplay(resultsGrid);
However, I get neither the 'forward' nor 'fast forward' buttons:
Is there something I"m missing? Do I need to do something when the DataProvider changes?
Judging by your previous question and screenshot, the remaining pager buttons on the right are simply hidden under the west pane.

Wrapping FlowPanel across FlexTable doesnt work

I am newbee to GWT,
I have separate class which I use for only displaying LIST,when I say list I basically am using FLEXTABLE to show my data...3 FLEXTABLE places side by side.
So, the problem I am facing here is...If I wrap all these FLEXTABLE with FLOWPANEL none of them get displayed on the screen. If I remove those FLOWPANEL wrapping around these FLEXTABLES all of them gets displayed on the screen.
Tried like this??
FlexTable f1 = new FlexTable();
f1.setWidget(...
f1.setWidget(...
FlexTable f2 = new FlexTable();
f2.setWidget(...
f2.setWidget(...
FlowPanel flowpanel= new FlowPanel();
flowpanel.add(f1);
flowpanel.add(f2);
RootLayoutPanel.get().add(flowpanel);//may be you forgot this line

automatic resize of the tab panel based on contents

Hello I have implemented something like
private VerticalPanel resultPanel;
private TabLayoutPanel tabPanel = new TabLayoutPanel(2.5, Unit.EM);
ResizeLayoutPanel resizePanel = new ResizeLayoutPanel();
myMethod(){
resizePanel.setWidth("100%");
resizePanel.setHeight("415px");
resizePanel.setWidget(tabPanel);
resultPanel = new VerticalPanel();
resultPanel.setWidth("100%");
resultPanel.add(resizePanel);
tabPanel.add(myVerticalPanel, tabHeader);
}
so the myVerticalPanel is the actual contents which is little large in height. As resizePanel height is set to 415px so rest of the contents are hidden.
I am looking for two things to achieve:
1. If there is a larger screen available then increase the tabPanel area to show more contents automatically
2. If screen is small then a scroll to appear to see rest of the contents
Please advise
You can try to replace the TabLayoutPanel with a HeaderPanel:
A panel that includes a header (top), footer (bottom), and content
(middle) area. The header and footer areas resize naturally. The
content area is allocated all of the remaining space between the
header and footer area.
Alternatively you can override the onResize() method your ResizeLayoutPanel calculate the height of your embedded content and set the appropriate height.
If you want scrolling functionality you have to embed your VerticalPanel in a ScrollPanel or use CSS to set the oferflow property.

GWT celltable Simple pager Next and previous buttons

I am working on a CellTable with a SimplePager. My paging works fine in the sense when i set the page size to be 5 only 5 records are being displayed. My question is that do next and previous buttons come by default or do we have to configure them. I have seen the show case example code and i do not see any external configurations . my SimplePager code is as follows:
//create pager
SimplePager.Resources resources = GWT.create(SimplePager.Resources.class);
SimplePager simplePager = new SimplePager(TextLocation.CENTER, resources , false, 0, true);
simplePager.setDisplay(cellTableSearchResults);
simplePager.setPageSize(5);
// create data provider
ListDataProvider<GridDTO> dataProvider = new ListDataProvider<GridDTO>();
dataProvider.addDataDisplay(cellTableSearchResults);
dataProvider.setList(components);
Please help.
SimplePager is a widget containing those buttons. Did you simply forgot to display it?
Set page size to celltable by cellTable.setPageSize(5);
Don't set simplepagers page size simplePager.setPageSize(5);
this will split cell table to show 5 rows as visible Items.

Error in GWT MapWidget

I am trying to add MapWidget to VerticalPanel but the map added on the
left corner:
And I added marker and the marker should be centered on the image
I can't see the marker when I load the map. I should navigate to this
location to show map.
The code for this
private FormPanel form = new FormPanel();
private VerticalPanel main = new VerticalPanel();
public Map(){
ScrollPanel container = new ScrollPanel();
initWidget(container);
container.setStyleName("FuoEgForm");
form.setWidget(main);
main.setSpacing(6);
container.add(main);
}
public MapWidget addMapWidget(){
MapWidget map = new MapWidget();
//map.setSize("100%", "100%");
map.setStyleName("gwt-map");
map.removeMapType(MapType.getNormalMap());
map.removeMapType(MapType.getSatelliteMap());
map.addMapType(MapType.getPhysicalMap());
map.addMapType(MapType.getHybridMap());
map.setCurrentMapType(MapType.getHybridMap());
//map.setSize("100%", "100%");
map.setWidth("500px");
map.setHeight("500px");
main.add(map);
}
How can I solve this issue? The map should fill the gray
boundary?
As of gwt-maps-1.1, the MapWidget implements the RequiresResize interface. When added to a panel that supports this interface (such as DockLayoutPanel), the widget automatically calls map.checkResizeAndCenter() whenever the panel containing the widget is resized. This new feature makes it possible to set your map size to 100% in both directions and fill up the available space on the screen. To use LayoutPanel subclasses properly, make sure your html page is set to use standards mode by adding as the first line in the document.
In gwt-maps 1.0, it may be necessary to force the map to resize its layout after the map is initially added. you can use the MapWidget.checkResizeAndCenter() method to clean this up. You may need to delay calling this function using a DeferredCommand or other mechanism to wait until after the DOM layout pass that resizes the map is called.
or you can find unexpected another unexpected reason that happened with me
i made the map invisible #constructor
and then set it visible if clicked on a button
the solution
make the map always visible :)
I insert these line below the add(map) :
LatLng c = mapWidget.getCenter();
resizeMap(mapWidget.getMVCObject());
mapWidget.setCenter(c);