http://www.telerik.com/community/forums/preview-thread/aspnet/treeview/disabling-checkbox-for-an-enabled-node.aspx
I'd like to have the same feature with threestatecheckbox enabled, how can i achieve this?
3 Answers, 1 is accepted
Unfortunately the three state checkbox do not have disable or readonly states by default.
You can try a workaround with the background image like here:
function
OnClientLoad(sender) {
var
$ = $telerik.$;
var
tri = $(
".DisabledCheckBox"
, sender.get_element()).siblings(
".rtUnchecked"
);
tri.unbind(
"click"
);
tri.css(
"background-image"
,
"url(/Images/3-state-checkbox-disabled.gif)"
);
tri.click(
function
() {
return
false
;
});
Hope this will help you.
Greetings,
Plamen Zdravkov
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!
Thanks for the answer.
Your Code doesnt work 100% for me, but it helped me alot.
1.) It only works for checkboxes that get populated as unchecked because of
var
tri = $(
".DisabledCheckBox"
, sender.get_element()).siblings(
".rtUnchecked"
);
2.) I had to swap the checked and unchecked states from your image, because it got loaded wrongly. (Image is attached)
To fix the first point i have modified your code to the following: (improvements are welcome)
function
OnClientLoad(sender) {
var
$ = $telerik.$;
var
arrState =
new
Array(
".rtUnchecked"
,
".rtChecked"
,
".rtIndeterminate"
);
for
(
var
i = 0; i < arrState.length; i++) {
var
tri = $(
".DisabledCheckBox"
, sender.get_element()).siblings(arrState[i]);
if
(tri !=
null
) {
tri.css(
"background-image"
,
"url(../Images/3-state-checkbox-disabled.gif)"
);
tri.unbind(
"click"
);
tri.click(
function
() {
return
false
;
});
}
}
}
And added the same function to OnClientNodePopulated in my treeView.
<
telerik:RadTreeView
ID
=
"treeView1"
runat
=
"server"
OnClientNodePopulated
=
"OnClientLoad"
OnClientLoad
=
"OnClientLoad"
>
</
telerik:RadTreeView
>
Also i'd like to mention, that this feature was wished for in May 17, 2005. So, i hope it will be added some day.
More than 6 Years is a really long time.
Please, excuse us for the inconvenience. Thank you for the feedback and for reminding us this feature.
Regards,Plamen Zdravkov
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!