Problem view complete list in a tiny ComboBox

  1. #1

    Problem view complete list in a tiny ComboBox

    I have a combobox with little width, but with item with long width.

    How can I do when click to display list, this list autowidth to index with text but the combobox remain the same width?
    (add image with explanation)

    Click image for larger version. 

Name:	cb-listfull width.png 
Views:	79 
Size:	24.8 KB 
ID:	5030

    My problem is, that in this tiny width combobox, when i display the list... I can't see the complete information about items, because they are cuted to the combobox width.

    Thanks in advance!
  2. #2
    Hello!

    If I understood you correctly you should use ListWidth attribute. Look at this example:

    <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 runat="server">
        <title>Comboboxes - Ext.NET Examples</title>
        <link href="../../../../resources/css/examples.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
        <form runat="server">
        <ext:ResourceManager 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 runat="server" Text="Set 'IDAHO' value">
            <Listeners>
                <Click Handler="#{ComboBox1}.setValue('ID');" />
            </Listeners>
        </ext:Button>
        <h2>
            Not Editable:</h2>
        <ext:ComboBox ID="ComboBox1" runat="server" StoreID="Store1" Editable="false" DisplayField="nick"
            ValueField="abbr" TypeAhead="true" Mode="Local" ForceSelection="true" EmptyText="Select a state..."
            Resizable="true" SelectOnFocus="true" ListWidth="600" />
        </form>
    </body>
    </html>
  3. #3
    @Baidaly thanks!!

    It's done and works perfect. Adding ListWidth option solve the problem.

    Thanks!!!!

Similar Threads

  1. Replies: 0
    Last Post: Jun 08, 2012, 11:49 AM
  2. Expand combobox list automatically.
    By rahesh in forum 1.x Help
    Replies: 0
    Last Post: Nov 11, 2011, 11:12 AM
  3. Combobox loses its list of items
    By PeterParsonage in forum 1.x Help
    Replies: 1
    Last Post: Feb 10, 2011, 10:46 PM
  4. Combobox autoSize to List width
    By johnsoftinfos in forum 1.x Help
    Replies: 4
    Last Post: Dec 10, 2010, 8:45 AM
  5. 0.82 Combobox view problem in IE
    By tenkyu in forum Bugs
    Replies: 4
    Last Post: Oct 15, 2010, 5:35 PM

Tags for this Thread

Posting Permissions