[CLOSED] ComboBox RemoveAll

  1. #1

    [CLOSED] ComboBox RemoveAll

    Hi!

    I am trying to use a removeAll on a combobox BEFORE pressing the 'V' the down arrow.

    Step to reproduce:

    1. Press clear;
    2. Press V. The data is still there.

    Thanks

    Code:

    <%@ Page Language="C#" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Store1.DataSource = new object[]
            {
                new object[] { "AL", "Alabama", "The Heart of Dixie" },
                new object[] { "AK", "Alaska", "The Land of the Midnight Sun" },
                new object[] { "AZ", "Arizona", "The Grand Canyon State" },
                new object[] { "AR", "Arkansas", "The Natural State" },
                new object[] { "CA", "California", "The Golden State" },
                new object[] { "CO", "Colorado", "The Mountain State" },
                new object[] { "CT", "Connecticut", "The Constitution State" },
                new object[] { "DE", "Delaware", "The First State" },
                new object[] { "DC", "District of Columbia", "The Nation's Capital" },
                new object[] { "FL", "Florida", "The Sunshine State" },
                new object[] { "GA", "Georgia", "The Peach State" },
                new object[] { "HI", "Hawaii", "The Aloha State" },
                new object[] { "ID", "Idaho", "Famous Potatoes" },
                new object[] { "IL", "Illinois", "The Prairie State" },
                new object[] { "IN", "Indiana", "The Hospitality State" },
                new object[] { "IA", "Iowa", "The Corn State" },
                new object[] { "KS", "Kansas", "The Sunflower State" },
                new object[] { "KY", "Kentucky", "The Bluegrass State" },
                new object[] { "LA", "Louisiana", "The Bayou State" },
                new object[] { "ME", "Maine", "The Pine Tree State" },
                new object[] { "MD", "Maryland", "Chesapeake State" },
                new object[] { "MA", "Massachusetts", "The Spirit of America" },
                new object[] { "MI", "Michigan", "Great Lakes State" },
                new object[] { "MN", "Minnesota", "North Star State" },
                new object[] { "MS", "Mississippi", "Magnolia State" },
                new object[] { "MO", "Missouri", "Show Me State" },
                new object[] { "MT", "Montana", "Big Sky Country" },
                new object[] { "NE", "Nebraska", "Beef State" },
                new object[] { "NV", "Nevada", "Silver State" },
                new object[] { "NH", "New Hampshire", "Granite State" },
                new object[] { "NJ", "New Jersey", "Garden State" },
                new object[] { "NM", "New Mexico", "Land of Enchantment" },
                new object[] { "NY", "New York", "Empire State" },
                new object[] { "NC", "North Carolina", "First in Freedom" },
                new object[] { "ND", "North Dakota", "Peace Garden State" },
                new object[] { "OH", "Ohio", "The Heart of it All" },
                new object[] { "OK", "Oklahoma", "Oklahoma is OK" },
                new object[] { "OR", "Oregon", "Pacific Wonderland" },
                new object[] { "PA", "Pennsylvania", "Keystone State" },
                new object[] { "RI", "Rhode Island", "Ocean State" },
                new object[] { "SC", "South Carolina", "Nothing Could be Finer" },
                new object[] { "SD", "South Dakota", "Great Faces, Great Places" },
                new object[] { "TN", "Tennessee", "Volunteer State" },
                new object[] { "TX", "Texas", "Lone Star State" },
                new object[] { "UT", "Utah", "Salt Lake State" },
                new object[] { "VT", "Vermont", "Green Mountain State" },
                new object[] { "VA", "Virginia", "Mother of States" },
                new object[] { "WA", "Washington", "Green Tree State" },
                new object[] { "WV", "West Virginia", "Mountain State" },
                new object[] { "WI", "Wisconsin", "America's Dairyland" },
                new object[] { "WY", "Wyoming", "Like No Place on Earth" } 
            };
            
            this.Store1.DataBind();
        }
    </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>Comboboxes - Ext.NET Examples</title>
    </head>
    <body>
        <form id="Form1" runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server" />
            
            <ext:Store ID="Store1" runat="server">
                <Reader>
                    <ext:ArrayReader>
                        <Fields>
                            <ext:RecordField Name="abbr" />
                            <ext:RecordField Name="state" />
                            <ext:RecordField Name="nick" />
                        </Fields>
                    </ext:ArrayReader>
                </Reader>            
            </ext:Store>
    
            <ext:Button ID="Button1" runat="server" Text="Clear">
                <Listeners>
                    <Click Handler="#{ComboBox1}.store.removeAll()" />
                </Listeners>
            </ext:Button>
            
            <ext:ComboBox 
                ID="ComboBox1" 
                runat="server" 
                StoreID="Store1" 
                Editable="false"
                DisplayField="state"
                ValueField="abbr"
                TypeAhead="true" 
                Mode="Local"
                ForceSelection="true"
                EmptyText="Select a state..."
                LazyInit="true"
                />
    
        </form>
    </body>
    </html>
    Last edited by Daniil; Dec 12, 2012 at 11:36 AM. Reason: [CLOSED]
  2. #2
    Hello!

    I couldn't reproduce with version 1.6. Can you say what version of Ext.NET are you using?
  3. #3
    I found what made the difference: mode="local". If you remove this line, and do the step said above, I wont clear the combobox.

    Do you know why mode="local" would make such difference?

    Thanks
    Last edited by SouthDeveloper; Dec 12, 2012 at 10:25 AM.
  4. #4
    Hi @SouthDeveloper,

    The default mode is Remote. Briefly, it means that data are reloaded when a ComboBox's trigger is clicked.

    If you don't load the data remotely, you should explicitly set up Mode="Local".
  5. #5
    Sweet!!!

    Thanks

Similar Threads

  1. [CLOSED] GridPanel removeAll
    By softmachine2011 in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 03, 2012, 2:53 PM
  2. Replies: 4
    Last Post: Nov 30, 2011, 5:25 AM
  3. [CLOSED] removeAll EditableGrid
    By SouthDeveloper in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 07, 2011, 10:07 AM
  4. [CLOSED] [1.0] #{Store1}.removeAll() does not reset grid paging
    By bsnezw in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jan 26, 2010, 1:22 PM
  5. RemoveAll selection of MultiSelect
    By n_s_adhikari@rediffmail.com in forum 1.x Help
    Replies: 2
    Last Post: Aug 09, 2009, 5:34 PM

Posting Permissions