Create a cellTable using CellTable.Resources interface. Add your
CellTableStyle.css file in your CellTable constructor. Construct the
header using cell interface.
//client side code.
interface TableResources extends CellTable.Resources
{
@Source(value = { CellTable.Style.DEFAULT_CSS,
"CellTableStyle.css" })
CellTable.Style cellTableStyle();
}
//construct the cellTable using cellTable Resources.
CellTable<Your_domain_class> cellTable = new
CellTable<Student>(15, GWT.<TableResources>
create(TableResources.class));
cellTable .setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
//Instatiate a column
Column<Your_domain_class, String> Column_ = new TableColumn
();
cellTable .addColumn(Column,"Department");
Column_.setFieldUpdater(new FieldUpdater<Your_domain_class,
String>()
{
@Override
public void update(int index, Your_domain_class object, String
value)
{
//set value to Your_domain_class.
}
});
cellTable .setColumnWidth(Column_, "25ex");
//Adding a header
Header<String> header = new Header<String>(new ClickableTextCell())
{
@Override
public String getValue() {
return "Header_title";
}
@Override
public void onBrowserEvent(Context context, Element parent,
NativeEvent event)
{
Window.alert("Header is clicked");
}
};
cellTable.addColumn(feesColumn, header , new
TextHeader("footer"));
//your column on cellTable
private class TableColumn extends Column<your_domain_class, String>
{
public TableColumn ()
{
super(new EditTextCell());
}
@Override
public String getValue(your_domain_class object)
{
return object.your_member_variable;
}
}
S. Abraham
www.DataStoreGwt.com
Persist objects directly in GAE