Hi,
We are using a workaround, once provided by you, to decorate checkboxes in treeview.
This was working fine until the new 2016 Q3 release...
In IE11, the hack doesn't work anymore, all other browsers are working!
The problem is that after a postback, all checked nodes are unchecked in IE11!
Is there an other workaround available, or can I do anything to make this work in IE11 again?
The workaround that work in previous versions looked like this:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="treeview.aspx.vb" Inherits="TestaTredjepartWeb.treeview" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
id
=
"Head1"
runat
=
"server"
>
<
title
></
title
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
asp:ScriptManager
ID
=
"s"
runat
=
"server"
>
</
asp:ScriptManager
>
<
telerik:RadCodeBlock
ID
=
"RadCodeBlock1"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function pageLoad()
{
var $ = $telerik.$;
var tree = $('#<%= RadTreeView1.ClientID %>');
var decorator = $find('<%= RadFormDecorator1.ClientID %>');
var boxes = $('input[type*=checkbox]');
boxes.removeAttr('class');
decorator.decorate(document.documentElement);
boxes.addClass('rtChk');
}
//Workaround 1 - attach to the OnClientNodeChecking event and manually set the decorator classes:
function OnClientNodeChecking(sender, args)
{
var decoratedCheckBox = $telerik.$(args.get_node().get_element()).find('input.rfdRealInput').next()[0];
if (decoratedCheckBox.className.indexOf("Unchecked") != -1)
{
decoratedCheckBox.className = "rfdCheckboxChecked";
} else
{
decoratedCheckBox.className = "rfdCheckboxUnchecked";
}
}
//Workaround 2 - remove the preventDefault() method of the TreeView when the checkbox is decorated ($target[0].id.indexOf("RadFormDecorator") == -1):
//Telerik.Web.UI.RadTreeView.prototype._preventLabelDefault = function (nodeElement, e) {
// $ = $telerik.$;
// var target = $telerik.getTouchTarget(e),
// $target = $(target),
// targetIsLabelDescendant = $(nodeElement).find("label").eq(0).has(e.target).length !== 0;
// //We should not prevent the default when the target is a link or the checkbox itself.
// //Also when the target is not a direct descendant of the label, which is the case when templates are used.
// if (targetIsLabelDescendant && $target[0].id.indexOf("RadFormDecorator") == -1 && !$target.is("a") && !$target.is("input")) {
// e.preventDefault();
// }
//};
</
script
>
</
telerik:RadCodeBlock
>
<
telerik:RadFormDecorator
ID
=
"RadFormDecorator1"
runat
=
"server"
DecoratedControls
=
"Default"
/>
<
div
>
<
telerik:RadTreeView
ID
=
"RadTreeView1"
runat
=
"server"
RenderMode
=
"Lightweight"
CheckBoxes
=
"true"
OnClientNodeChecking
=
"OnClientNodeChecking"
>
<
Nodes
>
<
telerik:RadTreeNode
Text
=
"aaa"
>
<
Nodes
>
<
telerik:RadTreeNode
Text
=
"123"
/>
<
telerik:RadTreeNode
Text
=
"234"
/>
<
telerik:RadTreeNode
Text
=
"345"
/>
<
telerik:RadTreeNode
Text
=
"456"
/>
<
telerik:RadTreeNode
Text
=
"567"
/>
</
Nodes
>
</
telerik:RadTreeNode
>
</
Nodes
>
</
telerik:RadTreeView
>
<
asp:Button
ID
=
"Button1"
runat
=
"server"
Text
=
"Click to do postback"
/>
</
div
>
</
form
>
</
body
>
</
html
>
Regards
Andreas