[CLOSED] I'm trying to un-select an item, but its NOT working.

  1. #1

    [CLOSED] I'm trying to un-select an item, but its NOT working.

    If I select an item, then if I want to un-select it, its NOT letting me...

    <%@ Page Language="C#" %>
    
    <%@ 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">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>MultiSelect - Ext.NET Examples</title>
    </head>
    <body>
        <form id="Form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        <h1>
            MultiSelect
        </h1>
        <br />
        <ext:FormPanel ID="Panel1" runat="server" Border="false" Width="300" Height="250" Layout="FitLayout">
            <Items>
                <ext:MultiSelect ID="MultiSelect1" runat="server" SingleSelect="true" AllowBlank="true">
                    <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" />
                    </Items>
                </ext:MultiSelect>
            </Items>
        </ext:FormPanel>
        </form>
    </body>
    </html>
    Last edited by Daniil; Aug 02, 2012 at 6:28 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Thanks for the report. We will investigate.
  3. #3
    For now, please set up
    <ListConfig runat="server">
        <CustomConfig>
            <ext:ConfigItem Name="selModel" Value="{ allowDeselect : true}" Mode="Raw" />
        </CustomConfig>
    </ListConfig>
    for the MultiSelect.
  4. #4
    That works, but when I click the button and nothing is selected, it still goes back to the Server.

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <script runat="server">
    
        protected void Select(object sender, DirectEventArgs e)
        {
            // NOTE: DO SERVER SIDE WORK !!!
            X.Msg.Alert("Server Side", "Client side validation passed !!!").Show();
        }
    
        
    </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>MultiSelect - Ext.NET Examples</title>
    </head>
    <body>
        <form id="Form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        <h1>
            MultiSelect
        </h1>
        <ext:Button ID="Button1" runat="server" OnDirectClick="Select" Text="Select" CausesValidation="false"
            AllowBlank="false" />
        <br />
        <ext:FormPanel ID="Panel1" runat="server" Border="false" Width="300" Height="250"
            Layout="FitLayout">
            <Items>
                <ext:MultiSelect ID="MultiSelect1" runat="server" SingleSelect="true" AllowBlank="false">
                    <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" />
                    </Items>
                    <ListConfig ID="ListConfig1" runat="server">
                        <CustomConfig>
                            <ext:ConfigItem Name="selModel" Value="{ allowDeselect : true}" Mode="Raw" />
                        </CustomConfig>
                    </ListConfig>
                </ext:MultiSelect>
            </Items>
        </ext:FormPanel>
        </form>
    </body>
    </html>
    Quote Originally Posted by Daniil View Post
    For now, please set up
    <ListConfig runat="server">
        <CustomConfig>
            <ext:ConfigItem Name="selModel" Value="{ allowDeselect : true}" Mode="Raw" />
        </CustomConfig>
    </ListConfig>
    for the MultiSelect.
  5. #5
    Why do you expect it should not go to server?

    You should manually stop the DirectEvent returning false from its Before handler.

    Also you can be interested in the FormBind functionality.
    http://docs.sencha.com/ext-js/4-1/#!...t-cfg-formBind
  6. #6
    I figure since I set 'AllowBlank=false' on the MultiSelect and it knows that the MultiSelect has no selected values and I had 'CauseValidation' set to true on the Button, it won't call the Direct Event.

    Any, I found a workaround, but the first time I select/unselect an item in the list it works, but the second time is DOES NOT work...

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <script runat="server">
    
        protected void Select(object sender, DirectEventArgs e)
        {
            // NOTE: DO SERVER SIDE WORK !!!
            X.Msg.Alert("Server Side", "Client side validation passed !!!").Show();
        }
    
        
    </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>MultiSelect - Ext.NET Examples</title>
        <style type="text/css">
            .icon-exclamation
            {
                padding-left: 25px !important;
                background: url(/icons/exclamation-png/ext.axd) no-repeat 3px 0px !important;
            }
            
            .icon-accept
            {
                padding-left: 25px !important;
                background: url(/icons/accept-png/ext.axd) no-repeat 3px 0px !important;
            }
        </style>
    </head>
    <body>
        <form id="Form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        <h1>
            MultiSelect
        </h1>
        <ext:Button ID="Button1" Disabled="true" runat="server" OnDirectClick="Select" Text="Select"
            CausesValidation="true" />
        <br />
        <ext:FormPanel ID="Panel1" runat="server" Border="false" Width="300" Height="250"
            Layout="Column">
            <Items>
                <ext:MultiSelect ID="MultiSelect1" runat="server" SingleSelect="true" AllowBlank="false">
                    <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" />
                    </Items>
                    <ListConfig runat="server">
                        <CustomConfig>
                            <ext:ConfigItem Name="selModel" Value="{ allowDeselect : true}" Mode="Raw" />
                        </CustomConfig>
                    </ListConfig>
                </ext:MultiSelect>
            </Items>
            <BottomBar>
                <ext:StatusBar ID="StatusBar1" runat="server" Height="25" />
            </BottomBar>
            <Listeners>
                <ValidityChange Handler="this.dockedItems.get(0).setStatus({
                                                         text : valid ? 'Form is valid' : 'Form is invalid', 
                                                         iconCls: valid ? 'icon-accept' : 'icon-exclamation'
                                                     });
                                                     #{Button1}.setDisabled(!valid);" />
            </Listeners>
        </ext:FormPanel>
        </form>
    </body>
    </html>
    Quote Originally Posted by Daniil View Post
    Why do you expect it should not go to server?

    You should manually stop the DirectEvent returning false from its Before handler.

    Also you can be interested in the FormBind functionality.
    http://docs.sencha.com/ext-js/4-1/#!...t-cfg-formBind
  7. #7
    Reproduced, thanks for the report.

    We are investigating a possible fix.
  8. #8
    The issue has been fixed in SVN, please update.

    Thanks again for the report.

    Also you can remove
    <CustomConfig>
        <ext:ConfigItem Name="selModel" Value="{ allowDeselect : true}" Mode="Raw" />
    </CustomConfig>
    and set up just
    <ListConfig runat="server" AllowDeselect="true" />
  9. #9
    Got the latest from SVN and it works great.

    Thanks...

    Quote Originally Posted by Daniil View Post
    The issue has been fixed in SVN, please update.

    Thanks again for the report.

    Also you can remove
    <CustomConfig>
        <ext:ConfigItem Name="selModel" Value="{ allowDeselect : true}" Mode="Raw" />
    </CustomConfig>
    and set up just
    <ListConfig runat="server" AllowDeselect="true" />

Similar Threads

  1. [CLOSED] How to select a ComboBox item by value?
    By vadym.f in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Apr 16, 2012, 4:15 PM
  2. [CLOSED] Combobox, select first item
    By Yevgeniy in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Nov 28, 2011, 12:05 PM
  3. [CLOSED] Accordion Select Item
    By CMA in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jun 16, 2009, 2:55 PM
  4. Accordion Select Item
    By CMA in forum 1.x Help
    Replies: 0
    Last Post: Jun 15, 2009, 12:15 PM
  5. Select a item in a Combobox
    By eliezer in forum 1.x Help
    Replies: 1
    Last Post: Apr 16, 2009, 12:23 PM

Tags for this Thread

Posting Permissions