Help with Combobox Two Columns

  1. #1

    Help with Combobox Two Columns

    Hello.
    I have one of these awesome controls:
    https://examples1.ext.net/#/Form/ComboBox/Two_Columns/
    I need to get rid of the little refresh button it has on the paging toolbar at the bottom.
    I know gridpanels have a HideRefresh="true" property. Is there something similar for this combo?

    Thank you.
  2. #2
    Hi,

    Please set up the following Focus listener.

    Example

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                Store store = this.ComboBox1.GetStore();
                store.DataSource = new object[] 
                { 
                    new object[] { "1", "item1" },
                    new object[] { "2", "item2" },
                    new object[] { "3", "item3" }
                };
                store.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>Ext.Net Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:ComboBox
                ID="ComboBox1" 
                runat="server" 
                PageSize="1" 
                Width="300">
                <Store>
                    <ext:Store runat="server">
                        <Reader>
                            <ext:ArrayReader>
                                <Fields>
                                    <ext:RecordField Name="value" />
                                    <ext:RecordField Name="text" />
                                </Fields>
                            </ext:ArrayReader>
                        </Reader>
                    </ext:Store>
                </Store>
                <Listeners>
                    <Focus Handler="this.pageTb.refresh.hide();" Delay="1" />
                </Listeners>
            </ext:ComboBox>
        </form>
    </body>
    </html>
  3. #3
    Hello, Daniil. Thanks for answering.
    Your solution works fine. However, the little refresh button disappears right before the user's eyes. Is there a way to avoid this behavior and just hide the button before the control is loaded?
    I tried using Render, BeforeRender and AfterRender with the Handler you provided, but no luck.

    Thank you.
  4. #4
    I can suggest this solution.

    Example

    <%@ Page Language="C#" %>
     
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
     
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                Store store = this.ComboBox1.GetStore();
                store.DataSource = new object[] 
                { 
                    new object[] { "1", "item1" },
                    new object[] { "2", "item2" },
                    new object[] { "3", "item3" }
                };
                store.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>Ext.Net Example</title>
    
        <script type="text/javascript">
            var onAfterRender = function (combo) {
                combo.un('focus', combo.initList, combo);
                combo.initList = combo.initList.createSequence(function () {
                    this.pageTb.refresh.hide();
                });
                combo.on('focus', combo.initList, combo, { single : true });
            };
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:ComboBox
                ID="ComboBox1"
                runat="server"
                PageSize="1"
                Width="300">
                <Store>
                    <ext:Store runat="server">
                        <Reader>
                            <ext:ArrayReader>
                                <Fields>
                                    <ext:RecordField Name="value" />
                                    <ext:RecordField Name="text" />
                                </Fields>
                            </ext:ArrayReader>
                        </Reader>
                    </ext:Store>
                </Store>
                <Listeners>
                    <AfterRender Handler="onAfterRender(this);" />
                </Listeners>
            </ext:ComboBox>
        </form>
    </body>
    </html>
  5. #5
    This works cool!
    Thank you very much.

Similar Threads

  1. Replies: 4
    Last Post: Jul 19, 2012, 8:46 PM
  2. Problems with ComboBox Two Columns
    By ascsolutions in forum 1.x Help
    Replies: 2
    Last Post: Jan 19, 2012, 12:32 PM
  3. Replies: 1
    Last Post: Jan 19, 2012, 12:11 PM
  4. Replies: 4
    Last Post: Nov 30, 2011, 5:25 AM
  5. About Two Columns in combobox...
    By CasualXX in forum 1.x Help
    Replies: 4
    Last Post: Jun 11, 2010, 6:00 AM

Tags for this Thread

Posting Permissions