This is a migrated thread and some comments may be shown as answers.

RADListBox transfer grouped item.

1 Answer 117 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Anthony
Top achievements
Rank 1
Anthony asked on 03 Jan 2012, 03:44 PM

When I use the RADListBox with grouped items. Everything displays correctly until I perform a client side transfer from one listbox to another. The transfered items append to the bottom of the listbox and are not grouped. How can I transfer and have everything regroup client side.



<script type="text/javascript">


        function onClientTransferred(sender, args) {


            //alert("transfer from id:" + args.get_sourceListBox().get_id());
            //alert("transfer to id:" + args.get_destinationListBox().get_id());


            var fromList = args.get_sourceListBox().get_items();
            var fromItem = args.get_item();
            var fromItemAttributes = args.get_item().get_attributes();
            var fromItemCat = fromItemAttributes.getAttribute("DataGroupField");
            alert("from item cat:" + fromItemCat);


            args.get_destinationListBox().trackChanges();
            var toList = args.get_destinationListBox().get_items();
            var toItem = args.get_destinationListBox().findItemByValue(args.get_item().get_value());
            var toItemAttributes = toItem.get_attributes();
            toItemAttributes.setAttribute("DataGroupField", fromItemCat);
            toItem.attributes = toItemAttributes;


            var index = fromList.indexOf(toItem);
            toList.removeAt(index);
            toList.insert(index, toItem);


            alert("to item:" + toItem.get_text());
            args.get_destinationListBox().commitChanges();


        }
</script>


<rei:REIRadListBox ID="lstFavItems" runat="server" AllowTransfer="true" TransferToID="lstTopFavItems" EnableDragAndDrop="true" EnableEmbeddedSkins="false"  DataTextField="DisplayText" DataValueField="UserFavoriteId" SelectionMode="Multiple" EnableFiltering="true" FilterBoxEmptyMessage="Type here to filter" Height="200" Width="370" 
TransferMode="Move"  OnTransferred="RadListBox_Transferred" AllowReorder="true"  OnClientTransferred="onClientTransferred"  />




<rei:REIRadListBox ID="lstTopFavItems" runat="server" Height="200" Width="370" EnableDragAndDrop="true" EnableFiltering="true" EnableEmbeddedSkins="false" FilterBoxEmptyMessage="Type here to filter" 
DataTextField="DisplayText" DataValueField="UserFavoriteId"  AllowReorder="true" />

1 Answer, 1 is accepted

Sort by
0
Dimitar Terziev
Telerik team
answered on 04 Jan 2012, 01:13 PM
Hi Anthony,

I've inspected the code snippets provided and as it appears you are grouping your items based on some attributes. The important part here is that you are adding the transferred item on a specific index in the items collection of the destination ListBox and it shouldn't be show at the bottom of the list as you have described.

In order to troubleshoot this issue, please open a support ticket and provide a runnable sample page demonstrating the issue so I could debug it locally.

Regards,
Dimitar Terziev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
ListBox
Asked by
Anthony
Top achievements
Rank 1
Answers by
Dimitar Terziev
Telerik team
Share this question
or