[CLOSED] Hide CheckBox in CheckMenuItem

  1. #1

    [CLOSED] Hide CheckBox in CheckMenuItem

    Hi,

    In older versions of Ext.NET 2.1 this test case doesn't show CheckBox in each item of menu. Now how can I hide it?

    TEST CASE
    <script runat="server">   
        protected void Page_Load(object sender, EventArgs e)
        {
            for (int i = 0; i < 10; i++)
            {
                var menuItem = new CheckMenuItem
                {
                    ID = string.Format("chk{0}", i),
                    Text = string.Format("Value {0}", i),
                    Group = "myGroup",
                    Checked = (i == 3)
                };
    
                if (menuItem.Checked)
                    myTooltip.Html = menuItem.Text;
    
                myButton.Menu.First().Items.Add(menuItem);
            }
        }
    </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>Ext.Net Example</title>
    </head>
    <body>
        <form runat="server">
        <ext:ResourceManager runat="server" />
        <ext:SplitButton ID="myButton" runat="server" AutoDataBind="true" Text="Button text">
            <Menu>
                <ext:Menu runat="server" />
            </Menu>
            <ToolTips>
                <ext:ToolTip runat="server" ID="myTooltip" Title="Tooltip Title" />
            </ToolTips>
        </ext:SplitButton>
        </form>
    </body>
    </html>
    Last edited by Daniil; Sep 25, 2012 at 2:32 PM. Reason: [CLOSED]
  2. #2
    Hi,

    If it worked, then, I think, it was the casual behavior.

    Probably, if you don't need checkboxes, you should not use CheckMenuItems. Though, I don't know the requirement. Please clarify it.
  3. #3
    Well, in v1.3 it works like in older v2.1 (without checkbox)... I think that since ExtJS 4.1.2 update this behaviour changes.

    I don't know if it is correct or not, but I think that is not a bug...

    As you see in the example, each option is highlighted with a round mark and also have a checkbox now.

    Is there any way to hide the checkbox like in the picture?

    Click image for larger version. 

Name:	checkmenuitem.png 
Views:	184 
Size:	6.3 KB 
ID:	4826
  4. #4
    Well, CheckMenuItem is a MenuItem with CheckBox. It is its destination.

    Maybe, setting respective CheckedCls and UncheckedCls can help to hide the CheckBoxes.
  5. #5
    Hi,

    Is it normal that only applying CheckedCls and UncheckedCls properties to a non-existent cls the checkbox and round mark dissapear?

    TEST CASE
    <script runat="server">   
        protected void Page_Load(object sender, EventArgs e)
        {
            for (int i = 0; i < 10; i++)
            {
                var menuItem = new CheckMenuItem
                {
                    ID = string.Format("chk{0}", i),
                    Text = string.Format("Value {0}", i),
                    Group = "myGroup",
                    Checked = (i == 3),
                    CheckedCls = "myCustomCls",
                    UncheckedCls = "myCustomCls"                
                };
    
                if (menuItem.Checked)
                    myTooltip.Html = menuItem.Text;
    
                myButton.Menu.First().Items.Add(menuItem);
            }
        }
    </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>Ext.Net Example</title>
    </head>
    <body>
        <form runat="server">
        <ext:ResourceManager runat="server" />
        <ext:SplitButton ID="myButton" runat="server" AutoDataBind="true" Text="Button text">
            <Menu>
                <ext:Menu runat="server" />
            </Menu>
            <ToolTips>
                <ext:ToolTip runat="server" ID="myTooltip" Title="Tooltip Title" />
            </ToolTips>
        </ext:SplitButton>
        </form>
    </body>
    </html>
  6. #6
    Well, yes, it overrides the default ones and doesn't break anything. Just no CSS rules are applied.
  7. #7
    Ok, finally I applied my custom css class.

    Thanks
  8. #8
    could you provide the css?
  9. #9
    Hi @RCN,

    Here you have:

    Code Behind:

    protected void Page_Load(object sender, EventArgs e)    
    {        
        for (int i = 0; i < 10; i++)        
        {            
            var menuItem = new CheckMenuItem            
            {                
                ID = string.Format("chk{0}", i),                
                Text = string.Format("Value {0}", i),                
                Group = "myGroup",                
                Checked = (i == 3)   
                Tag = "myTag",
                CheckedCls = "customCheckedMenuItem",
                UncheckedCls = "noClass"                     
            };   
                      
            if (menuItem.Checked)                
                myTooltip.Html = menuItem.Text; 
                        
            myButton.Menu.First().Items.Add(menuItem);        
        }    
    }

    CSS

    .customCheckedMenuItem .x-menu-group-icon
    {
        background-image: url("/extjs/resources/themes/images/default/menu/group-checked-gif/ext.axd");
    }
    Regards.

Similar Threads

  1. CheckMenuItem bug?
    By lbs7 in forum 1.x Help
    Replies: 3
    Last Post: Jun 30, 2010, 12:28 PM
  2. [CLOSED] CheckboxSelectionModel Checkbox hide
    By majestic in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jun 29, 2010, 2:14 PM
  3. [1.0] Checkboxselectionmodel hide/disable checkbox
    By SouthDeveloper in forum 1.x Help
    Replies: 1
    Last Post: Mar 22, 2010, 2:19 PM
  4. Replies: 7
    Last Post: Jan 21, 2009, 2:20 AM
  5. [CLOSED] Gridpanel header checkbox hide
    By speedstepmem3 in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Nov 19, 2008, 7:41 AM

Tags for this Thread

Posting Permissions