in GWT, How to add a row on top of header of celltable? -


this interesting, how can add row on top of header of celltable in gwt?

ok, say,gwt header support sorting, want other stuffs on each of column (such filter, hide, ....)

so want add row on top of header of celltable. on row, there r many button, each button corresponding column. when user click button can other stuffs filter or hide.

example:

button1 - button2 - button3.

header1 - header2 - header3.

cell 11 - cell 12 - cell 13.

cell 21 - cell 22 - cell 23.

more cell....

the way using gwt extending celltable implementation , create own hacking code in part celltable creates header. have consider adding many methods add buttons, handlers etc. have deal before , tedious task.

but have option of modifying dom once table has been created. there many ways that, easier way know using gwtquery aka gquery.

in case use code this:

 // import gquery stuff  import static com.google.gwt.query.client.gquery.*;   // create table , add colums  final celltable<myobject> celltable = ...  [...]    // delay until table has been full rendered, use gquery delay() because   // of syntax use scheduler or timer  $(celltable).delay(0, new function(){     public void f() {       // add div each header, add html though      $("th", celltable).prepend($("<div class='mypanel' style='height: 40px'/>"));       // gquery's widget plugin able promote dom elements       // div/th/... etc htmlpanels      gquery panels = $(".mypanel", celltable).as(widgets).panel();       // gquery can return sorted list of widgets asociated set of elements      list<htmlpanel> list = panels.widgets(htmlpanel.class);       // can add gwt widget panels      (int = 0; < list.size(); i++) {        list.get(i).add(new button("button: " + i));      }    } }); 

here screenshot of produces code above:

celltable buttons

this approach implies have import gwtquery project, honestly, dont imagine me working on gwt project without :-),

gquery helps lot when designers ask enhancing gwt-widgets , don't want enforce tweaks (which times implies complex coding , investigation) simple things modify dom generated widget.

additionally gquery comes lot of stuff can take advantage of, easy ajax syntax, promises, plugins, use js methods , properties without writing jsni, etc.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -