[FIXED] [#916] [1.x] DocumentReady handler function bug fix

  1. #1

    [FIXED] [#916] [1.x] DocumentReady handler function bug fix

    Hi,

    The DocumentReady handler function Fn attribute has been a known bug of the ResourceManager object for a while. Would it be possible to provide a bug fix and commit it to the SVN branches? Here's a code patch that was put in place on our end although probably there's a better fix out there:

    ResourceManager.cs
            internal void RegisterEvents(ResourceManager manager)
            {
                ResourceManager realManager = manager;
    
                if (manager is ResourceManagerProxy)
                {
                    realManager = this.ResourceManager;
                }
    
                if (!manager.Listeners.DocumentReady.IsDefault)
                {
                    string temp = manager.Listeners.DocumentReady.Fn;
    
                    if (manager.Listeners.DocumentReady.Handler.IsNotEmpty())
                    {
                        temp = manager.Listeners.DocumentReady.Handler;
                    }
                    // BEGIN Bug Fix code
                    if (manager.Listeners.DocumentReady.Fn.IsNotEmpty())
                    {
                        temp = string.Format("({0}).call(this);", temp);
                    }
                    // END Bug Fix code
    
                    realManager.RegisterOnReadyScript(TokenUtils.ReplaceIDTokens(temp, this.Page));
                }
            }
    Last edited by Daniil; Oct 14, 2015 at 1:22 PM. Reason: [FIXED] [#916] [1.x]
  2. #2
    Hi Vadym,

    Thank you for the report and the bug fix!

    Created an Issue.
    https://github.com/extnet/Ext.NET/issues/916

    I will be committing the fix a bit later. Maybe, next week.

    Here is a test case.

    Example
    <%@ Page Language="C#" %>
    
    <!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 onDocumentReady = function () {
                alert("onDocumentReady");
            };
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server">
                <Listeners>
                    <DocumentReady Fn="onDocumentReady" />
                </Listeners>
            </ext:ResourceManager>
        </form>
    </body>
    </html>
  3. #3
    It has been fixed in the SVN branches/1 revision #6589.

    Thank you again the report and the suggest fix.
  4. #4
    Thanks for committing the fix!

Similar Threads

  1. [CLOSED] History control is unavailable in DocumentReady handler
    By vadym.f in forum 2.x Legacy Premium Help
    Replies: 6
    Last Post: Apr 30, 2013, 4:39 PM
  2. [CLOSED] Client side change component handler function....
    By rthiney in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jul 24, 2012, 3:54 PM
  3. Replies: 2
    Last Post: Oct 27, 2011, 12:35 PM
  4. Replies: 1
    Last Post: Sep 28, 2011, 3:50 AM
  5. Replies: 0
    Last Post: Apr 14, 2009, 6:10 PM

Tags for this Thread

Posting Permissions