[CLOSED] DateMenu in a SplitButton

  1. #1

    [CLOSED] DateMenu in a SplitButton

    Hello,

    The following example illustrates a complication with the date picker in a SplitButton.

    Example.aspx:
    <%@ 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 btnShoppingCartReportCash_Select(object sender, AjaxEventArgs e)
        {
            lblResult.Text = dateShoppingCartReportCash.Picker.SelectedDate.ToString("g");
        }
    </script>
    
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head id="Head1" runat="server">
        <title>Example Page</title>
    </head>
    <body>
        <form id="Form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="True" />
        <ext:ScriptManager ID="ScriptManager2" runat="server" AjaxViewStateMode="Include" StateProvider="PostBack" Theme="Gray" />
        
            <ext:SplitButton runat="server" Text="Testing">
                <Menu>
                    <ExtJS:Menu>
                        <Items>
                            <ExtJS:MenuItem runat="server" Text="Cash Drawer" Icon="Calendar">
                                <Menu>
                                    <ExtJS:DateMenu ID="dateShoppingCartReportCash" runat="server">
                                        <AjaxEvents>
                                            <Select OnEvent="btnShoppingCartReportCash_Select" />
                                        </AjaxEvents>
                                    </ExtJS:DateMenu>
                                </Menu>
                            </ExtJS:MenuItem>
                        </Items>
                    </ExtJS:Menu>
                </Menu>
            </ext:SplitButton>
            <ext:Label ID="lblResult" runat="server" Text="Waiting ..." />
        
    
        </form>
    </body>
    </html>
    Replication steps:

    1. Load page
    2. Select context menu
    3. Select a Christmas from date picker
    4. Notice AJAX Event updates lblResult with current date (12/05/2008)
    5. Select context menu again
    6. Select January 1st, 2009
    7. Notice Christmas date is now displayed in lblResult

    Any questions, please feel free to ask.

    Cheers,
    Timothy
  2. #2

    RE: [CLOSED] DateMenu in a SplitButton

    Hi Timothy,

    We think this is a timing problem with the AjaxEvent firing to early/quickly. Can you try setting Delay="20" on the <Select> AjaxEvent.


    Example


    <Select OnEvent="btnShoppingCartReportCash_Select" Delay="20" />

    Geoffrey McGill
    Founder
  3. #3

    RE: [CLOSED] DateMenu in a SplitButton

    Yup that is the problem.

    Can it be resolved without the delay?

    Cheers,
    Timothy
  4. #4

    RE: [CLOSED] DateMenu in a SplitButton

    Can it be resolved without the delay?
    For the moment, no. The Delay is required, but...

    There is another work-around, move the <AjaxEvent> to the <Picker> property. The <Picker> is the configuration object for the DatePicker in the DateMenu. The <Picker> fires all the same AjaxEvent and Listeners as the <ext:DatePicker>.

    Moving the <Select> AjaxEvent to the <Picker> will prevent the "double-fire" issue with the event.

    Example

    <ext:DateMenu ID="DateMenu1" runat="server">
        <Picker runat="server">
            <AjaxEvents>
                <Select OnEvent="DateMenu1_Select" />
            </AjaxEvents>
        </Picker>
        <%--<AjaxEvents>
            <Select OnEvent="DateMenu1_Select" />
        </AjaxEvents>--%>
    </ext:DateMenu>
    Hope this helps.

    Geoffrey McGill
    Founder

Similar Threads

  1. Replies: 2
    Last Post: Aug 15, 2011, 9:49 AM
  2. [CLOSED] hideOnClick in DateMenu is lost...
    By pil0t in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: May 13, 2010, 12:25 PM
  3. [CLOSED] StandOut Attribute of SplitButton
    By rthiney in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Dec 08, 2009, 8:04 PM
  4. [CLOSED] Set value of datemenu
    By wazige in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Nov 17, 2009, 5:36 AM
  5. [8.1] Splitbutton in gridpanel
    By plykkegaard in forum 1.x Help
    Replies: 0
    Last Post: Oct 29, 2009, 5:13 PM

Posting Permissions