[CLOSED] Multicombo deselect all problem

  1. #1

    [CLOSED] Multicombo deselect all problem

    Hi,

    Can you tell me what's wrong with this code. I would like to deselect all selected items when unchecking the first item. But it's not working:

    <%@ Page Language="C#" %>
    
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    
    <!DOCTYPE html>
    
    
    <html>
    <head id="Head1" runat="server">
        <title>MultiCombo</title>
    </head>
    <body>
        <form id="Form1" runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server" />
            <ext:MultiCombo ID="MultiCombo1" runat="server" Width="260">
                <Items>
                    <ext:ListItem Text="Select All" Value="0" />
                    <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>
                <Listeners>
                 <Select Handler="if (index==0) #{MultiCombo1}.selectAll();"/>
                 <BeforeDeselect Handler="if (index==0) #{MultiCombo1}.clearValue();"/>
               </Listeners>
            </ext:MultiCombo>
        </form>
    </body>
    </html>
    
    Martin
    Last edited by Daniil; Sep 17, 2013 at 8:17 AM. Reason: [CLOSED]
  2. #2
    Hi Martin,

    A component instance and an array of selected records are passed to a MultiCombo's Select listener. There is no the index argument. So, a JavaScript error occurs if select an item.

    As for deselecting all. The BeforeDeselect listener fires for every deselect items. So, a recursion occurs there.

    Though, even if avoid recursion this way:
    <BeforeDeselect Handler="if (!this.beforeDeselectLocked) {
                                if (index === 0) {
                                    this.beforeDeselectLocked = true;
                                    this.clearValue();
                                    this.beforeDeselectLocked = false;
                                }
                            }"/>
    the clearValue method call clear the value, but doesn't clear selection.

    Here is a test case to reproduce.
    <%@ Page Language="C#" %>
     
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
     
    <!DOCTYPE html>
    <html>
    <head runat="server">
        <title>MultiCombo</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
    
            <ext:Button runat="server" Text="Clear" Handler="App.MultiCombo1.clearValue();" />
    
            <ext:MultiCombo ID="MultiCombo1" runat="server">
                <Items>
                    <ext:ListItem Text="Item 1" Value="1" />
                    <ext:ListItem Text="Item 2" Value="2" />
                </Items>
            </ext:MultiCombo>        
        </form>
    </body>
    </html>
  3. #3
    clearValue issue is fixed in SVN
  4. #4
    Quote Originally Posted by Vladimir View Post
    clearValue issue is fixed in SVN
    Works now...using BeforeSelect instead of Select solves the other issue also..

    Thanks !

    Martin

Similar Threads

  1. [CLOSED] MultiCombo can't deselect items
    By jchau in forum 2.x Legacy Premium Help
    Replies: 10
    Last Post: Sep 05, 2013, 2:14 PM
  2. Replies: 2
    Last Post: Jul 30, 2013, 1:44 PM
  3. MULTICOMBO selecting problem...
    By antoreegan in forum 2.x Help
    Replies: 0
    Last Post: May 22, 2013, 6:10 AM
  4. Replies: 1
    Last Post: Dec 04, 2012, 8:46 AM
  5. [1.0] MultiCombo Problem Selecting
    By koss in forum 1.x Help
    Replies: 4
    Last Post: Apr 15, 2010, 3:31 PM

Posting Permissions