[CLOSED] Multicombo with partially readonly listitems

  1. #1

    [CLOSED] Multicombo with partially readonly listitems

    Hi
    Is it possible to make a multicombo have some items disabled/readonly? here is an example how it should look like, it is not multicombox but a button with menu that emulates a multicombo.

     <ext:Button 
                ID="Button1" 
                runat="server" 
                Icon="Rgb" 
                Text="[Select Colors]" 
                Width="200">
                <Menu>
                    <ext:Menu runat="server" Width="200">
                        <Defaults>
                            <ext:Parameter Name="HideOnClick" Value="false" Mode="Raw" />
                        </Defaults>
                        <Items>
                            <ext:CheckMenuItem runat="server" Text="Red" CheckHandler="updateButtonText" Width="194" />
                            <ext:CheckMenuItem runat="server" Text="Green" CheckHandler="updateButtonText" />
                            <ext:CheckMenuItem runat="server" Text="Blue" CheckHandler="updateButtonText" Disabled="true" Checked="true" />
                        </Items>                    
                    </ext:Menu>
                </Menu>
            </ext:Button>
    Attached Thumbnails Click image for larger version. 

Name:	2013-02-26 10_04_05-MultiCombo - Ext.NET Examples.png 
Views:	32 
Size:	6.6 KB 
ID:	5712  
  2. #2
    Hi,

    Try this
    <%@ Page Language="C#" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
         
    <script runat="server">
         
        protected void Page_Load(object sender, EventArgs e)
        {
    
    
            this.ComboBoxStore.DataSource = new List<object> { 
                new {value = 1, text = "Item 1", disabled = false},
                new {value = 2, text = "Item 2", disabled = true},
                new {value = 3, text = "Item 3", disabled = false}
            };
            this.ComboBoxStore.DataBind();
        }
     
    </script>
     
    <!DOCTYPE html>
     
    <html>
    <head runat="server">
        <title></title>
    
    
        <style type="text/css">
            .x-multicombo-item-disabled {         
              color: silver;
            } 
        </style>
    
    
       
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />        
             
            <ext:Store ID="ComboBoxStore" runat="server">
                <Model>
                    <ext:Model runat="server">
                        <Fields>
                            <ext:ModelField Name="value" />
                            <ext:ModelField Name="text" />
                            <ext:ModelField Name="disabled" Type="Boolean" />
                        </Fields>
                    </ext:Model>
                </Model>
            </ext:Store>
     
            <ext:MultiCombo runat="server" StoreID="ComboBoxStore" ValueField="value" DisplayField="text">
                <ListConfig>
                    <Tpl>
                        <Html>
                            <ul class="x-list-plain">
                                <tpl for=".">
                                    <li role="option" unselectable="on" class="x-boundlist-item {[values.disabled ? "x-multicombo-item-disabled" : ""]}">
                                        <div class="x-combo-list-item {[this.getItemClass(values)]}">
    				                       <div class="x-mcombo-text">{text}</div>
                                        </div>
                                    </li>
                                </tpl>
                            </ul>
                        </Html>
                    </Tpl>
                </ListConfig>
                <Listeners>
                    <BeforeSelect Handler="return !record.data.disabled;" />
                    <BeforeDeselect Handler="return !record.data.disabled;" />
                </Listeners>
            </ext:MultiCombo>
        </form>
    </body>
    </html>
  3. #3

    [closed]

    Perfect! thank you very much.

Similar Threads

  1. [CLOSED] Can't add ListItems to ComboBox in codebehind [1.0]
    By SFritsche in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jul 18, 2012, 5:05 PM
  2. [CLOSED] selected row are partially highlighted on gridpanel
    By leon_tang in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Sep 19, 2011, 1:41 PM
  3. [CLOSED] ListItems / ComboBox - value is always a String?
    By wagger in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Mar 31, 2011, 3:46 PM
  4. [1.0] Website shows partially in Firefox on IIS
    By nextSTEP in forum 1.x Help
    Replies: 2
    Last Post: Dec 15, 2010, 7:00 AM
  5. [CLOSED] adding listitems dynamically in a combobox
    By LeeTheGreek in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Dec 22, 2009, 4:26 PM

Tags for this Thread

Posting Permissions