Hi,
I have two RadListBoxes:
I would like to have only one item checked in the list on the right. To achieve it, I'm using following javascript functions:
Generally it works - but there are some strange issues:
1. When I check any item on the left list and then I transfer it - it's still checked, even though uncheck function was called on it. Firebug shows that _checkBoxElement's "checked" property is set to false (before transferring it was set to true), so I think the "checked" property has been changed, but it's still shown as checked.
2. Then on the right list I can select many items (even though unchecked function is called every time).
Does anyone know how to solve that problem?
Thank you in advance.
I have two RadListBoxes:
<
telerik:RadListBox
ID
=
"AllAreas"
runat
=
"server"
AllowTransfer
=
"True"
TransferToID
=
"SelectedAreas"
Height
=
"135px"
Width
=
"250px"
CheckBoxes
=
"true"
OnClientTransferred
=
"OnAreaTransferred"
/>
<telerik:RadListBox
ID
=
"SelectedAreas"
runat
=
"server"
Height
=
"125px"
Width
=
"220px"
OnClientTransferred
=
"OnAreaTransferred"
OnClientItemChecked="OnDefaultAreaChecked" CheckBoxes
=
"true"
/>
I would like to have only one item checked in the list on the right. To achieve it, I'm using following javascript functions:
function
OnAreaTransferred(sender, e) {
var
items = e.get_items();
items.forEach(
function
(it) {
it.uncheck();});
}
function
OnDefaultAreaChecked(sender, eventArgs) {
var
item = eventArgs.get_item();
var
value = item.get_value();
var
checked = item.get_checked();
var
listBox = item.get_listBox();
if
(checked)
{
var
items = listBox.get_items();
items.forEach(
function
(it) {
it.uncheck(); });
}
item.set_checked(checked);
}
Generally it works - but there are some strange issues:
1. When I check any item on the left list and then I transfer it - it's still checked, even though uncheck function was called on it. Firebug shows that _checkBoxElement's "checked" property is set to false (before transferring it was set to true), so I think the "checked" property has been changed, but it's still shown as checked.
2. Then on the right list I can select many items (even though unchecked function is called every time).
Does anyone know how to solve that problem?
Thank you in advance.