Vaadin - Disable Column reordering for particular column -
i'm doing project in vaadin 7.
in project, need disable column reordering feature particular columns in treetable?
i'm searching function 'setcolumnreorderids()'.
is possible in vaadin 7.
or else need write code 'columnreorderlistener()'?
update
this code set first column fixed in treetable. want disable reordering in hierarchy column in tree table.
public class customtreetable extends treetable { private static final long serialversionuid = 1l; private object[] visiblecolumns; private keymapper<object> columnidmap = new keymapper<object>(); @override public void paintcontent(painttarget target) throws paintexception { super.paintcontent(target); paintcolumnorder(target); } private void paintcolumnorder(painttarget target) throws paintexception { visiblecolumns = this.getvisiblecolumns(); final string[] colorder = new string[visiblecolumns.length]; int = 0; colorder[i++] = columnidmap.key("column 1"); // logic keep first column fixed (object colid : visiblecolumns) { if(!colid.equals("column 1")) { colorder[i++] = columnidmap.key(colid); } } target.addvariable(this, "columnorder", colorder); } }
update 2
i tried oskar said..
in addition
paintcolumnorder(target).
i'm calling
paintvisiblecolumnorder(target), paintavailablecolumns(target), paintvisiblecolumns(target).
i'm able stop reordering table headers. but, body still reordering. guesses on issue?
in documentation there setcolumnreorderingallowed()
allows control reordering of all columns. if case control particular ones looks me custom behaviour , go own implementation. columnreorderevent
generated after processing action therefore implementing own columnreorederlistener
won't here think.
all actual magic want change happens in private table.paintcolumnorder()
called public table.paintcontent()
, called public treetable.paintcontent()
(see sources of table , treetable). solution be:
- extend
treetable
- override
paintcontent()
merged copies oftable.paintcontent()
,treetable.paintcontent()
- replace
paintcolumnorder()
call custom logic.
update
ok, see it's more tricky thought @ beginnig, since there no easy way access of required fields , methods after subclassing treetable... moreover, columns reorered on client side , change event status sent inform server. don't know how handle custom reordering without creating custom gwt widget :(