I have a RadListBox which has 11 items. And I need to have the first 7 items as static which means they shouldn't be reordered. I have written the below javascript and it works just fine.
The 8th item in listbox is still movable(up) and this shouldn't happen. I need to reorder the items only after 7th item till 11th item and only within themselves. Means out of 11 items, first 7 items order should be static and from 8 to 11 these fields can be reordered.
Can anyone suggest how this can be achieved?
HTML:
<telerik:RadListBox ID="RadListBox" runat="server"
AllowReorder="true OnClientSelectedIndexChanging="RadListBox_Reordering"/>
JS:
function RadListBox_Reordering(sender, eventArgs) {
var value = eventArgs.get_item().get_value();
if (value == "Item1" || value == "Item2" || value == "Item3" || value == "Item4" || value == "Item5" || value == "Item6" || value == "Item7") {
eventArgs.set_cancel(true);
}
}
You can use the OnClientDropping event, which is cancelable, to detect where the reordered item is landing.
https://www.telerik.com/forums/how-to-disable-dragging-dropping-to-first-position