[CLOSED] MultiSelect change sequence without use drag drop

  1. #1

    [CLOSED] MultiSelect change sequence without use drag drop

    Hi,
    I add MuiltiSelect and I want to change the listitem sequence.
    I find the sample to change sequence use drag drop,
    but I want to use button click to chang . How to resolve it??
    Click image for larger version. 

Name:	multiselect.jpg 
Views:	50 
Size:	20.2 KB 
ID:	4432
    Last edited by Daniil; Jul 10, 2012 at 11:24 AM. Reason: [CLOSED]
  2. #2
    Hi,

    You should deal directly with the MultiSelect Store.

    Here is the example how to move the second record at the top.

    Example
    var store = App.MultiSelect1.getStore(),
        record = store.getAt(1);
    
    store.remove(record);
    store.insert(0, record);
  3. #3
    Hi,
    I use MultiSelect Store.
    At run time, click up or down button,program show up error message.
    "例外詳細資訊: System.Web.HttpException: 由於內容不是常值,所以無法取得 form1 的內部內容。"
    how to resolve it??

    <%@ Page Language="C#" %>
    <%@ Import Namespace="System.Data" %>
    <%@ Import Namespace="System.Web" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <script runat="server">
     protected void sequp(object sender, DirectEventArgs e)
        {
            Ext.Net.Store itemstore = MultiSelect1.GetStore();
            Int32 seq = MultiSelect1.SelectedItem.Index;
            Ext.Net.ModelProxy record = itemstore.GetAt(MultiSelect1.SelectedItem.Index);
            itemstore.Remove(record);
            itemstore.Insert(seq - 1, record);
        }
    
     protected void seqdown(object sender, DirectEventArgs e)
     {
         Ext.Net.Store itemstore = MultiSelect1.GetStore();
         Int32 seq = MultiSelect1.SelectedItem.Index;
         Ext.Net.ModelProxy record = itemstore.GetAt(MultiSelect1.SelectedItem.Index);
         itemstore.Remove(record);
         itemstore.Insert(seq + 1, record);
     }
      
      
    </script>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <ext:ResourceManager ID="ResourceManager1" runat="server">
            </ext:ResourceManager>
    
            <ext:MultiSelect ID="MultiSelect1" runat="server" Width="100">
               <Items>
                  <ext:ListItem Text="item1"></ext:ListItem>
                  <ext:ListItem Text="item2"></ext:ListItem>
                  <ext:ListItem Text="item3"></ext:ListItem>
                  <ext:ListItem Text="item4"></ext:ListItem>
                  <ext:ListItem Text="item5"></ext:ListItem>
               </Items>
            
            </ext:MultiSelect>
                <ext:Button ID="Button1" runat="server" Text="up">
                    <DirectEvents>
                        <Click onEvent="sequp">
                        </Click>
                    </DirectEvents>
                </ext:Button>
    
                <ext:Button ID="Button2" runat="server" Text="down">
                    <DirectEvents>
                        <Click onEvent="seqdown">
                        </Click>
                    </DirectEvents>
                </ext:Button>
        </div>
        </form>
    </body>
    </html>
    Quote Originally Posted by Daniil View Post
    Hi,

    You should deal directly with the MultiSelect Store.

    Here is the example how to move the second record at the top.

    Example
    var store = App.MultiSelect1.getStore(),
        record = store.getAt(1);
    
    store.remove(record);
    store.insert(0, record);
  4. #4
    I have demonstrated the JavaScript code. I would suggest to implement it client side.

Similar Threads

  1. Drag and drop server validation in multiselect
    By 4712635 in forum 1.x Help
    Replies: 3
    Last Post: Feb 22, 2012, 10:11 AM
  2. [CLOSED] Alternative to Drag/Drop sorting in Multiselect
    By jthompson in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jan 24, 2011, 7:55 PM
  3. [CLOSED] Multiselect Drag and Drop
    By amitpareek in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Dec 01, 2009, 12:51 PM
  4. Drag & Drop from dataview to multiselect
    By Ares in forum Feature Requests
    Replies: 0
    Last Post: May 14, 2009, 3:33 PM
  5. [CLOSED] MultiSelect with drag and drop, Drop listener
    By Jurke in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jan 30, 2009, 8:25 AM

Posting Permissions