How to add a widget to a cell in the GWT cell table

Now I'm stuck on the issue of pagination widgets in GWT.

I use the Cell table to display a list of instances of the UI Binder class (Ex: LocationView). http://gwt.google.com/samples/Showcase/Showcase.html#!CwCellTable This is a CellTable showcase.

Now I want to add my widget (UI binding class) to each cell of the table. It will look like this enter image description here

In this cell table, each cell is a widget (LocationView - interface binding class):

enter image description here

So, how can I create this table using a cell table (I do not use a grid because it does not support pagination)

or If I cannot use the Cell table to create this table, then what can I use for it that supports pagnigation (if the number of LocationView (the icon you see) exceeds 6, it will go to page 2).

Thanks for the help!

+2
source share
2 answers

Creating custom cells in the guide explains how to do this.

+3
source

To add a widget to a cell, I use a custom CellTableBuilder, and I set a unique identifier for the cell that should contain the widget. Then I attach the widget to the DOM and move it to the cell.

void addWidgetToCell(final String cellId, final Widget widget) { Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { Element cellElem = DOM.getElementById(cellId); if (!widget.isAttached()) { // attach the detail to DOM (cannot attach it directly to the cell, because it has existing parent widget) RootPanel.get().add(widget); } // move detail element under the cell element cellElem.appendChild(widget.getElement()); } }); } 
+2
source

Source: https://habr.com/ru/post/1436308/


All Articles