What can be provided to the location attribute of a
<c:SimplePager ui:field='pager' location='HERE' />
I tryed CENTER, but it didnt work, I see in the expense sample app that they dont have a location attribute but instead set it on the creation of it in the UiBinder. But I cant do that since its a required attribute. What to do?
You must provide SimplePager.TextLocation
, which can be CENTER, LEFT or RIGHT.
<c:SimplePager ui:field='pager' location='CENTER'/>
The only solution I see at the moment is working with @UiField(provided = true)
. Not sure if that is of any help but check out the small example below anyway.
The ui.xml:
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:c="urn:import:com.google.gwt.user.cellview.client">
<ui:style>
</ui:style>
<g:HTMLPanel>
<c:CellList ui:field="list" />
<c:SimplePager ui:field="pager" />
<g:Button ui:field="more" text="addMore" />
</g:HTMLPanel>
</ui:UiBinder>
and the widget:
public class TestView extends Composite {
private static TestViewUiBinder uiBinder = GWT.create(TestViewUiBinder.class);
interface TestViewUiBinder extends UiBinder<Widget, TestView> {}
@UiField(provided = true)
CellList<String> list;
@UiField(provided = true)
SimplePager pager;
@UiField
Button more;
private int counter = 0;
private ListDataProvider<String> provider;
public TestView() {
list = new CellList<String>(new TextCell());
pager = new SimplePager();
initWidget(uiBinder.createAndBindUi(this));
provider = new ListDataProvider<String>(getList());
provider.addDataDisplay(list);
pager.setDisplay(list);
pager.setPageSize(5);
}
private LinkedList<String> getList() {
LinkedList<String> list = new LinkedList<String>();
list.add("1st");
list.add("2nd");
list.add("3rd");
list.add("4th");
list.add("5th");
return list;
}
@UiHandler("more")
void onMoreClick(ClickEvent event) {
provider.getList().add(++counter + " more");
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With