PDA

View Full Version : text-selection in TreePanel not working



s_k
19 Jun 2012, 12:50 AM
Hi,

we are using gxt 2.2.4 and try to enable text selection in TreePanels.



treePanel.disableTextSelection(false);


..but disableTextSelection(false) does nothing, TreePanel ignores the disableTextSelection-Flag.

Our next try was to change the rendering template of the TreeView and
a. replace unselectable=on with unselectable=off
b. remove the x-unselectable class
c. add the x-selectable class



treePanel.setView(new TreePanelView(){
@Override
public String getTemplate(ModelData m, String id, String text, AbstractImagePrototype icon,
boolean checkable, boolean checked, Joint joint, int level,
com.extjs.gxt.ui.client.widget.treepanel.TreePanelView.TreeViewRenderMode renderMode) {
String tpl = super.getTemplate(m, id, text, icon, checkable, checked, joint, level, renderMode);
if (tpl != null) {
tpl = tpl.replace("unselectable=on", "unselectable=off");
tpl = tpl.replace("class=\"", "class=\"x-selectable ");
}
return tpl;
}
});

treePanel.removeStyleName("x-unselectable");
treePanel.addStyleName("x-selectable");




We defined x-selectable and x-selectable * as follows


.x-selectable, .x-selectable * {
-moz-user-select: text !important;
-khtml-user-select: text !important;
-webkit-user-select: text !important;
}


...but text selection isn't working...

Is there another working approach to enable text selection?
This is a mandatroy request for our application and I think text selection should be kind of standard, not?

Thanks in advance,
Sebastian