Nov 05, 2012, 4:49 PM
[CLOSED] MultiSelect moving items programmatically
Hi,
Please provide a code sample or link to an example demonstrating how to move selected items from one MultiSelect control to another. I'm working with the example at https://examples1.ext.net/#/Form/MultiSelect/Overview/. What I need on top of this is 4 buttons in the middle that will perform selected item(s) left/right move and bulk left/right move by selecting all the items on the list and moving them over to the right or left.
Edit in: Please also suggest how to get the selected items with their DataIndexes from the MultiSelect control on the client. I've tried http://forums.ext.net/showthread.php...-a-MultiSelect but there's no such method. Could it be conditionally defined depending on the MultiSelect configuration? There's the selectedIds property, which I'm not sure about. The closest match I've found so far is the getValue() method but it doesn't give me the DataIndex property to get a hold of the Store record.
Please provide a code sample or link to an example demonstrating how to move selected items from one MultiSelect control to another. I'm working with the example at https://examples1.ext.net/#/Form/MultiSelect/Overview/. What I need on top of this is 4 buttons in the middle that will perform selected item(s) left/right move and bulk left/right move by selecting all the items on the list and moving them over to the right or left.
Edit in: Please also suggest how to get the selected items with their DataIndexes from the MultiSelect control on the client. I've tried http://forums.ext.net/showthread.php...-a-MultiSelect but there's no such method. Could it be conditionally defined depending on the MultiSelect configuration? There's the selectedIds property, which I'm not sure about. The closest match I've found so far is the getValue() method but it doesn't give me the DataIndex property to get a hold of the Store record.
<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
private void ShowSelection(MultiSelect ctrl)
{
StringBuilder sb = new StringBuilder(256);
sb.Append("Ext.Msg.alert('Selection', '");
foreach (SelectedListItem item in ctrl.SelectedItems)
{
sb.AppendFormat("Value={0}, Index={1}, Text={2} <br/>", item.Value, item.Index, item.Text);
}
sb.Append("');");
ctrl.AddScript(sb.ToString());
}
</script>
<!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>Overview of MultiSelect - Ext.NET Examples</title>
<link href="../../../../resources/css/examples.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.label
{
font: bold 11px tahoma,arial,sans-serif;
width: 300px;
height: 15px;
padding: 5px 0;
border: 1px dotted #99bbe8;
color: #15428b;
cursor: default;
margin: 10px;
background: #dfe8f6;
text-align: center;
margin-left: 0px;
}
</style>
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:TabPanel ID="TabPanel1" runat="server" Plain="true" Height="400" LayoutOnTabChange="true">
<Items>
<ext:Panel ID="Panel13" runat="server" Title="Drag/Drop (Insert Mode)" Padding="10">
<Items>
<ext:TableLayout ID="TableLayout5" runat="server" Columns="2">
<Cells>
<ext:Cell>
<ext:Label ID="Label9" runat="server" Html="<div class='label'>Available Items</div>" />
</ext:Cell>
<ext:Cell>
<ext:Label ID="Label10" runat="server" Html="<div class='label'>Selected Items</div>" />
</ext:Cell>
<ext:Cell>
<ext:Panel ID="Panel14" runat="server" Border="false" BodyStyle="height: 260px;">
<Items>
<ext:MultiSelect ID="MultiSelect9" runat="server" DragGroup="grp1" DropGroup="grp2,grp1"
Width="300" Height="250" KeepSelectionOnClick="WithCtrlKey">
<Items>
<ext:ListItem Text="Item 1" Value="1" />
<ext:ListItem Text="Item 2" Value="2" />
<ext:ListItem Text="Item 3" Value="3" />
<ext:ListItem Text="Item 4" Value="4" />
<ext:ListItem Text="Item 5" Value="5" />
<ext:ListItem Text="Item 20" Value="20" />
<ext:ListItem Text="Item 30" Value="30" />
<ext:ListItem Text="Item 40" Value="40" />
<ext:ListItem Text="Item 50" Value="50" />
<ext:ListItem Text="Item 100" Value="100" />
<ext:ListItem Text="Item 200" Value="200" />
<ext:ListItem Text="Item 300" Value="300" />
<ext:ListItem Text="Item 400" Value="400" />
<ext:ListItem Text="Item 500" Value="500" />
<ext:ListItem Text="Item 1000" Value="1000" />
<ext:ListItem Text="Item 2000" Value="2000" />
<ext:ListItem Text="Item 3000" Value="3000" />
<ext:ListItem Text="Item 4000" Value="4000" />
<ext:ListItem Text="Item 5000" Value="5000" />
<ext:ListItem Text="Item 10000" Value="10000" />
<ext:ListItem Text="Item 20000" Value="20000" />
<ext:ListItem Text="Item 30000" Value="30000" />
<ext:ListItem Text="Item 40000" Value="40000" />
<ext:ListItem Text="Item 50000" Value="50000" />
</Items>
</ext:MultiSelect>
</Items>
</ext:Panel>
</ext:Cell>
<ext:Cell>
<ext:Panel ID="Panel15" runat="server" Border="false" BodyStyle="height: 260px;">
<Items>
<ext:MultiSelect ID="MultiSelect10" runat="server" DragGroup="grp2" DropGroup="grp1,grp2"
Width="300" Height="250" KeepSelectionOnClick="WithCtrlKey">
<Items>
<ext:ListItem Text="Item 6" Value="6" />
<ext:ListItem Text="Item 7" Value="7" />
<ext:ListItem Text="Item 8" Value="8" />
<ext:ListItem Text="Item 9" Value="9" />
<ext:ListItem Text="Item 10" Value="10" />
</Items>
</ext:MultiSelect>
</Items>
</ext:Panel>
</ext:Cell>
</Cells>
</ext:TableLayout>
</Items>
</ext:Panel>
</Items>
</ext:TabPanel>
</form>
</body>
</html>
Last edited by Daniil; Nov 06, 2012 at 1:55 PM.
Reason: [CLOSED]