[CLOSED] Is it possible to use a ComboBox or DropDownList including icon and text for each item?

  1. #1

    [CLOSED] Is it possible to use a ComboBox or DropDownList including icon and text for each item?

    Hi,

    Is it possible to use a ComboBox or DropDownList including icon and text for each item, like you do with the CycleButton?


  2. #2

    RE: [CLOSED] Is it possible to use a ComboBox or DropDownList including icon and text for each item?

    Hi,

    We have added Icon support for TextField (and inheritors)
    Here is the sample which demonstrates the icon combo (please update from SVN first)

    <%@ 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">
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Store1.DataSource = new object[]
            {
                new object[] { ResourceManager.GetIconClassName(Icon.FlagFr), "France"},
                new object[] { ResourceManager.GetIconClassName(Icon.FlagCa), "Canada"},
                new object[] { ResourceManager.GetIconClassName(Icon.FlagDe), "Germany"},
                new object[] { ResourceManager.GetIconClassName(Icon.FlagUs), "United States"},
                new object[] { ResourceManager.GetIconClassName(Icon.FlagIt), "Italy"}
            };
            
            this.Store1.DataBind();
    
            ResourceManager1.RegisterIcon(Icon.FlagFr);
            ResourceManager1.RegisterIcon(Icon.FlagCa);
            ResourceManager1.RegisterIcon(Icon.FlagDe);
            ResourceManager1.RegisterIcon(Icon.FlagUs);
            ResourceManager1.RegisterIcon(Icon.FlagIt);
        }
    </script>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>IconCombo</title>
        <link href="../../../../resources/css/examples.css" rel="stylesheet" type="text/css" />
        <style type="text/css">
             .icon-combo-item {
                background-repeat: no-repeat ! important;
                background-position: 3px 50% ! important;
                padding-left: 24px ! important;
            }
        </style>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server" />
            
            <ext:Store ID="Store1" runat="server">
                <Reader>
                    <ext:ArrayReader>
                        <Fields>
                            <ext:RecordField Name="iconCls" />
                            <ext:RecordField Name="name" />
                        </Fields>
                    </ext:ArrayReader>
                </Reader>            
            </ext:Store>
    
            <ext:ComboBox 
                ID="ComboBox1" 
                runat="server"
                StoreID="Store1" 
                Width="250"
                Editable="false"
                DisplayField="name"
                ValueField="name"
                Mode="Local"
                TriggerAction="All"
                EmptyText="Select a country...">
                <Template runat="server">
                    <Html>
                        <tpl for=".">
                            <div class="x-combo-list-item icon-combo-item {iconCls}">
                                {name}
                            
    
                        </tpl>
                    </Html>
                </Template>  
                <Listeners>
                    <Select Handler="this.setIconCls(record.get('iconCls'));" />
                </Listeners>  
            </ext:ComboBox>    
        </form>
    </body>
    </html>
  3. #3

    RE: [CLOSED] Is it possible to use a ComboBox or DropDownList including icon and text for each item?

    Hi Vladimir,

    You did a very nice job with the icon combo.

    Thanks very much,

Similar Threads

  1. Replies: 1
    Last Post: Mar 05, 2012, 8:59 AM
  2. [CLOSED] Change combobox item text
    By jchau in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Jan 25, 2011, 1:20 PM
  3. Replies: 10
    Last Post: Apr 05, 2010, 1:42 AM
  4. Replies: 5
    Last Post: Mar 05, 2010, 3:15 PM
  5. Replies: 1
    Last Post: Jan 27, 2010, 12:19 PM

Posting Permissions