I'm looking at using a Table component to display a table model that
updates occasionally. To test the component I created a table with an
empty data model and later on (after an RPC callback) I'm adding rows
to my data model. However the table does not reflect the changes. In
my data model I'm calling fireTableDataChanged() which ultimately
calls Table.tableChanged(), but this method appears missing an
implementation:
public void tableChanged(TableModelEvent event) {
if (event == null || event.getFirstRow() == TableModelEvent.ALL_ROWS) {
table.getDataTable().deselectAllRows();
// TODO
return;
}
if (event.getType() == TableModelEvent.Type.INSERT) {
} else if (event.getType() == TableModelEvent.Type.DELETE) {
} else {
}
Is there anything I can do to make this work?
Cheers,
Chris.
public static class LogSummaryPanel extends Composite {
private final Table<String[]> table;
private final StringArrayTableModel tableModel;
public LogSummaryPanel() {
final LayoutPanel vBox = new LayoutPanel(new BoxLayout(Orientation.VERTICAL));
vBox.setPadding(0);
final String[] columnNames = {
"Col1", "Col2", "Col3", "Col4", "Col5"
};
tableModel = new StringArrayTableModel(new String[0][5]);
table = new Table<String[]>(tableModel, new
DefaultTableColumnModel<String[]>(columnNames));
table.setPageSize(2);
final PagingOptions pagingOptions = new PagingOptions(table);
vBox.add(table, new BoxLayoutData(FillStyle.BOTH));
vBox.add(pagingOptions);
...
}
public void updateLog() {
Object[][] dataObj = new Object[][] {
{ "Mary", "Campione", "Snowboarding", new Integer(5), new
Boolean(false)},
{"Alison", "Huml", "Rowing", new Integer(3), new Boolean(true)},
{"Kathy", "Walrath", "Knitting", new Integer(2), new
Boolean(false)},
{"Sharon", "Zakhour", "Speed reading", new Integer(20),
new Boolean(true)},
{"Philip", "Milne", "Pool", new Integer(10), new Boolean(false)}
};
String[][] data = new String[dataObj.length][5];
int i, j;
for (i = 0; i < dataObj.length; i++) {
for (j = 0; j < 5; j++) {
data[i][j] = dataObj[i][j].toString();
}
}
tableModel.setData(data);
}
}
public class StringArrayTableModel extends AbstractTableModel<String[]> {
private String[][] data;
public StringArrayTableModel(final String[][] data) {
this.data = data;
}
public int getRowCount() {
return data.length;
}
public void setData(final String[][] data) {
this.data = data;
fireTableDataChanged();
}
public Object getValueAt(final int rowIndex, final int columnIndex) {
return data[rowIndex][columnIndex];
}
public void setValueAt(Object value, int rowIndex, int columnIndex) {
data[rowIndex][columnIndex] = value.toString();
fireTableCellUpdated(rowIndex, columnIndex);
}
}
yes, filling a Table widget after an RPC is not ready. It works only for
ListBox so far:
http://69.20.122.77/gwt-mosaic-current/Showcase.html#CwListBoxBinding
but all those widgets need still work.
Its better for you to use ScrollTable or the PagingScrollTable from GWT
Incubator:
http://69.20.122.77/gwt-mosaic-current/Showcase.html#CwScrollTable
http://69.20.122.77/gwt-mosaic-current/Showcase.html#CwPagingScrollTable
both:
http://gwt-mosaic.googlecode.com/svn/tags/0.1.8/doc/org/gwt/mosaic/ui/client/table/ScrollTable.html
and
are modified versions of Scrolltable and PagingScrollTable and use a
LayoutPanel, but you can use also the GWT Incubator gen2 tables. Soon I
will modify them to use a LayoutPanel.
Kind Regards,
George.
> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the Google Groups "gwt-mosaic" group.
> To post to this group, send email to gwt-m...@googlegroups.com
> To unsubscribe from this group, send email to gwt-mosaic+...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/gwt-mosaic?hl=en
> -~----------~----~----~----~------~----~------~--~---
>
>
>
if its possible please send me code to test. I don't know what exactly
the problem is.
George.
Chris Lowe wrote:
> Hi George,
>
> I sort of have a PagingScrollTable working now. In fact, in hosted
> mode it's working fine. However when I compile to final code the
> table body doesn't render! I've added some logging trace to my code
> and I can see the right callbacks are being invoked and even cell
> renderers are called as expected. The table PageOptions component
> also works fine and shows the correct number of pages. I've tried
> both IE7 and FF3.
>
> I'm not sure where to begin debugging something like this, I don't
> suppose anyone has seen this before and could offer some advice on
> where to start?
>
> Cheers,
>
> Chris.
>
> 2009/2/8 Chris Lowe <chris.lowe.uk <http://chris.lowe.uk>@gmail.com
> <http://gmail.com>>
>
> Thanks George, I'll take a look.
>
> 2009/2/8 G. Georgopoulos <georgopoul...@gmail.com
> <mailto:georgopoul...@gmail.com>>:
final LayoutPanel vBox = new LayoutPanel(new BoxLayout(Orientation.VERTICAL));
vBox.setPadding(0);
// (create scroll table and paging options)
vBox.add(scrollTable, new BoxLayoutData(FillStyle.BOTH));
vBox.add(pagingOptions);