vaadin7 - How to add new Columns to table in Vaadin and how to place a link in vaadin table -
i new vaadin, have created table , can able populate data in through beanitemcontainer, bellow code this.
public component getmaincontent(viewchangelistener.viewchangeevent event) { list<executionplanvo> executionplanvos = executionplandelegate.getexecutionplans(getsearchvo()); table table = new table(); beanitemcontainer<executionplanvo> container = new beanitemcontainer<executionplanvo>(executionplanvo.class, executionplanvos); container.addbean(new executionplanvo()); table.setcontainerdatasource(container); table.setvisiblecolumns( new object[] {"billofladingno" , "containerno" , "housebill" , "carrier" , "customer" , "origin" , "pol" , "transshipment" , "pod" , "destination" , "start" , "completion" , "status"}); table.setcolumnheaders( new string[] {"bill of lading" , "container no." , "house bill" , "carrier" , "customer" , "origin" , "pol" , "transshipment" , "pod" , "destination" , "start (lt)" , "completion (lt)" , "status"}); table.setstylename("ep-list-table"); return table; }
i have 2 questions here, 1. want change billofladingno column link, permorm action when click ? 2. wanted add 1 more column couple of link icons?
can me how can add columns ?
thanks in advance kiran.
you can create class implement columngenerator return link , icon. have done sample below
class linker implements columngenerator{ /** * */ private static final long serialversionuid = 1l; @override public object generatecell(table source, object itemid, object columnid) { // todo auto-generated method stub item item = source.getitem(itemid); link link = new link(); string linkcaption = item.getitemproperty("billofladingno").tostring(); link.setcaption(linkcaption); link.setresource(new externalresource("http:/www.domain.com/"+linkcaption)); return link; } } class linkicons implements columngenerator{ /** * */ private static final long serialversionuid = 1l; @override public object generatecell(table source, object itemid, object columnid) { // todo auto-generated method stub label icons = new label(); icons.seticon(fontawesome.link); return icons; } } table.addgeneratedcolumn("billoflading", new linker()); table.addgeneratedcolumn("link", linkicons);
be sure make billoflading bean invisible , add generated column ids table visible ids.
Comments
Post a Comment