what event will be trigger when the dropdown button was pressed in combobox?

  1. #1

    what event will be trigger when the dropdown button was pressed in combobox?

    Hi, guys!

    what event will be trigger when the dropdown button was pressed in combobox?

    such like this:

    combobox.StoreID = "Store1"
    //combobox.beforeselect+=Loaddata;

    void Loaddata(sender,ajaxeventargs)
    {
    //databind....
    Store1.DataSource=....
    }

    not load the data in Page_Load()
  2. #2

    RE: what event will be trigger when the dropdown button was pressed in combobox?

    Hi,

    I think in your case the most appropriate event is BeforeQuery. List of all event you can investigate at


    http://extjs.com/deploy/dev/docs/#Ex...omboBox-events



  3. #3

    RE: what event will be trigger when the dropdown button was pressed in combobox?



    thanks your quick reply!
    here is my code, but unsuccess.
    <%@ Page Language="C#" %>
    
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" 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)
        { 
            ComboBox1.AjaxEvents.BeforeSelect.Event  +=  DataBind ;
        }
    
    
        protected void DataBind(object sender, AjaxEventArgs 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"}, 
            };
    
    
            this.Store1.DataBind();
        }
        
    </script>
    
    
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head id="Head1" runat="server">
        <title>Comboboxes</title>
        <link href="../../../../resources/css/examples.css" rel="stylesheet" type="text/css" />
        <style type="text/css">
            .list-item {
                font:normal 11px tahoma, arial, helvetica, sans-serif;
                padding:3px 10px 3px 10px;
                border:1px solid #fff;
                border-bottom:1px solid #eeeeee;
                white-space:normal;
                color:#555;
            }
            .list-item h3 {
                display:block;
                font:inherit;
                font-weight:bold;
                color:#222;
            }
        </style>
    </head>
    <body>
        <form id="form1" runat="server">
            <ext:ScriptManager ID="ScriptManager1" runat="server" />
            
            <ext:Store ID="Store1" runat="server" AutoLoad="true">
                <Reader>
                    <ext:ArrayReader>
                        <Fields>
                            <ext:RecordField Name="abbr" />
                            <ext:RecordField Name="state"/>
                            <ext:RecordField Name="nick"/>
                        </Fields>
                    </ext:ArrayReader>
                </Reader>            
            </ext:Store>
    <ext:Panel runat ="server" >
    <Body>
            <ext:ComboBox 
                ID="ComboBox1" 
                runat="server"
                StoreID="Store1" 
                Width="250"
                Editable="false"
                DisplayField="state"
                ValueField="abbr"
                TypeAhead="true" 
                Mode="Local"
                ForceSelection="true"
                TriggerAction="All"
                EmptyText="Select a state..."
                ItemSelector="div.list-item"
                Select&#111;nfocus="true">
               <%-- <AjaxEvents >
                <BeforeSelect OnEvent="DataBind" ></BeforeSelect>
                </AjaxEvents>--%>
                <Template ID="Template1" runat="server">
                    <tpl for=".">
                        <div class="list-item">
                             <h3>{state}</h3>
                             {nick}
                        
    
                    </tpl>
                </Template>    
            </ext:ComboBox>    
            </Body></ext:Panel>
            
    <ext:Panel ID="pnlTest" runat ="server" >
    <Body>
            
            </Body></ext:Panel>
            <br />
            <br />
            <div  id="cboTest"  />
        </form>
    </body>
    </html>
  4. #4

    RE: what event will be trigger when the dropdown button was pressed in combobox?



    hi, vladimir. Sorry, i use the wrong event.

    Yes, the right event is "BeforeQuery", Thank you a lot!

    <%@ Page Language="C#" %>
    
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" 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)
        { 
            //ComboBox1.AjaxEvents.BeforeSelect.Event  +=  DataBind ;
            //ComboBox1.AjaxEvents.TriggerClick.Event += DataBind;
            ComboBox1.AjaxEvents.BeforeQuery.Event += DataBind;
        }
    
    
        protected void DataBind(object sender, AjaxEventArgs 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"}, 
            };
    
    
            this.Store1.DataBind();
        }
        
    </script>
    
    
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head id="Head1" runat="server">
        <title>Comboboxes</title>
        <link href="../../../../resources/css/examples.css" rel="stylesheet" type="text/css" />
        <style type="text/css">
            .list-item {
                font:normal 11px tahoma, arial, helvetica, sans-serif;
                padding:3px 10px 3px 10px;
                border:1px solid #fff;
                border-bottom:1px solid #eeeeee;
                white-space:normal;
                color:#555;
            }
            .list-item h3 {
                display:block;
                font:inherit;
                font-weight:bold;
                color:#222;
            }
        </style>
    </head>
    <body>
        <form id="form1" runat="server">
            <ext:ScriptManager ID="ScriptManager1" runat="server" />
            
            <ext:Store ID="Store1" runat="server" AutoLoad="true">
                <Reader>
                    <ext:ArrayReader >
                        <Fields>
                            <ext:RecordField Name="abbr" />
                            <ext:RecordField Name="state"/>
                            <ext:RecordField Name="nick"/>
                        </Fields>
                    </ext:ArrayReader>
                </Reader>            
            </ext:Store>
    <ext:Panel runat ="server" >
    <Body>
            <ext:ComboBox 
                ID="ComboBox1" 
                runat="server"
                StoreID="Store1" 
                Width="250"
                Editable="true"
                DisplayField="state"
                ValueField="abbr" 
                Mode="Local"
                TriggerAction="All"
                EmptyText="Select a state..."
                ItemSelector="div.list-item"
                Select&#111;nfocus="true">
               <%-- <AjaxEvents >
                <BeforeSelect OnEvent="DataBind" ></BeforeSelect>
                </AjaxEvents>--%>
                <Listeners>
                <%--    <TriggerClick Handler="Ext.Msg.alert('Message', '<br /><br />Text: ' + el.getValue());" />
                    <BeforeSelect Handler ="alert('Message');" />--%>
                </Listeners>
    
    
                <Template ID="Template1" runat="server">
                    <tpl for=".">
                        <div class="list-item">
                             <h3>{state}</h3>
                             {nick}
                        
    
                    </tpl>
                </Template>    
            </ext:ComboBox>    
            </Body></ext:Panel>
            
    <ext:Panel ID="pnlTest" runat ="server" >
    <Body>
            
            </Body></ext:Panel>
            <br />
            <br />
            <div  id="cboTest"  />
        </form>
    </body>
    </html>

Similar Threads

  1. [CLOSED] Additonal DropDown trigger on the right
    By georgek in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Nov 22, 2011, 8:06 PM
  2. Replies: 2
    Last Post: May 14, 2011, 6:29 PM
  3. Replies: 4
    Last Post: Nov 19, 2010, 1:39 PM
  4. Replies: 1
    Last Post: Jan 27, 2010, 11:21 AM

Posting Permissions