In Opera (9.63) the user can select (and copy) the nodes text. In Firefox 3.0.8 it seems that you cant select the text at all. And in IE 7.0 the user must (start) select from the left outside the node. We are using the RadTreeView in a forum and the users need to be able to copy text. Any solutions?
Regards
Jan
4 Answers, 1 is accepted
The text selection under Firefox is disabled intentionally as there are unwanted effects when you try to drag the nodes. Still, you can enable the text selection by using the following CSS style.
<style type="text/css"> |
.RadTreeView .rtLI |
{ |
-moz-user-select: text !important; |
} |
</style> |
Alternatively, you can use the following approach:
ASPX:
<form id="form1" runat="server"> |
<telerik:RadScriptManager ID="RadScriptManager1" runat="server"> |
</telerik:RadScriptManager> |
<script type="text/javascript"> |
function OnClientNodeEditStart(sender, eventArgs) { |
var node = eventArgs.get_node(); |
if (node.get_text() != "") { |
eventArgs.get_node().get_inputElement().readOnly = true; |
} |
} |
</script> |
<telerik:RadTreeView ID="RadTreeView1" runat="server" AllowNodeEditing="true" OnClientNodeEditStart="OnClientNodeEditStart"> |
<NodeTemplate> |
<%# Container.Text %> |
</NodeTemplate> |
<Nodes> |
<telerik:RadTreeNode runat="server" Text="Root RadTreeNode1"> |
<Nodes> |
<telerik:RadTreeNode runat="server" Text="Child RadTreeNode 1"> |
</telerik:RadTreeNode> |
<telerik:RadTreeNode runat="server" Text="Google"> |
</telerik:RadTreeNode> |
<telerik:RadTreeNode runat="server" Text="Child RadTreeNode 3"> |
</telerik:RadTreeNode> |
</Nodes> |
</telerik:RadTreeNode> |
</Nodes> |
</telerik:RadTreeView> |
</form> |
Code-behind:
protected void Page_Load(object sender, EventArgs e) |
{ |
RadTreeView1.DataBind(); |
} |
Regards,
Paul
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
That worked just fine. But are there any possible solutions for Internet Explorer?
Regards
Jan
The node's text selection works under IE (though in a bit different way) and there's nothing more we can do on the matter.
Kind regards,
Paul
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
setTimeout(
'EnabelRadTreeViewTextSelection()', 100);
function
EnabelRadTreeViewTextSelection()
{
var RadTreeView1 = document.getElementById("<%=RadTreeView1.ClientID %>");
if (RadTreeView1 == null) setTimeout('EnabelRadTreeViewTextSelection()', 100);
var arrayElement = RadTreeView1.getElementsByTagName("span");
var arrayElement_A_tabs = RadTreeView1.getElementsByTagName("a");
replaceTreeNodeClassName(arrayElement);
replaceTreeNodeClassName(arrayElement_A_tabs);
}
function
replaceTreeNodeClassName(arrayElement)
{
if (arrayElement == null) return;
for (var i=0; i<arrayElement.length; i++)
{
if (arrayElement[i].className == "rtIn")
{
arrayElement[i].className =
"";
}
}
}