CellTable custom header help.

124 views
Skip to first unread message

Konstantin Zolotarev

unread,
Oct 6, 2011, 2:47:50 AM10/6/11
to google-we...@googlegroups.com
How could I create such table ?


Stanislav Ievlev

unread,
Oct 6, 2011, 2:54:42 AM10/6/11
to google-we...@googlegroups.com
You can create a custom resources and initialize CellTable with them.

--
public class CustomTable<T> extends CellTable<T> {

  public static interface TableResources extends CellTable.Resources {
    @Source({CellTable.Style.DEFAULT_CSS, "CustomTable.css"})
    TableStyle cellTableStyle();
  }

  public static interface TableStyle extends CellTable.Style {}
  private static TableResources defaultResources = GWT.create(TableResources.class);

  private TableResources resources;

  public CustomTable(int pageSize, ProvidesKey<T> keyProvider)
  {
    super(pageSize, defaultResources, keyProvider);
    ...
--


2011/10/6 Konstantin Zolotarev <Konstantin...@gmail.com>
How could I create such table ?


--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/gBKC-AZq9HwJ.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Sudhakar Abraham

unread,
Oct 6, 2011, 9:39:55 AM10/6/11
to Google Web Toolkit
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

Konstantin Zolotarev

unread,
Oct 13, 2011, 9:55:16 AM10/13/11
to google-we...@googlegroups.com
There is no problem with table styles. I have problem with table header.

I couldn't create 2 level header. 
Is there any solutions ?

Jeff Larsen

unread,
Oct 13, 2011, 10:53:59 AM10/13/11
to google-we...@googlegroups.com
Upgrade to trunk. There is a custom header builder in there. 

Konstantin Zolotarev

unread,
Oct 13, 2011, 11:26:03 AM10/13/11
to google-we...@googlegroups.com
Thanks a lot. Tomorrow I'll check this.

Jeff Larsen

unread,
Oct 13, 2011, 11:35:17 AM10/13/11
to google-we...@googlegroups.com

Konstantin Zolotarev

unread,
Oct 13, 2011, 1:08:57 PM10/13/11
to google-we...@googlegroups.com
Exactly this I was looking for. 

Thanks one more time !
Reply all
Reply to author
Forward
0 new messages