[FIXED] [1.7] [2.2] js generate bug when use InsertHtml

  1. #1

    [FIXED] [1.7] [2.2] js generate bug when use InsertHtml

    See below code:
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            X.Fly("rootDiv").InsertHtml(InsertPosition.AfterBegin, "<span>foo bar</span>");
        }
    </script>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html id="Html1" runat="server" xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title></title>
    </head>
    <body>
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        <ext:Viewport ID="Viewport1" runat="server">
            <Content>
                <div id="rootDiv">
                </div>
            </Content>
        </ext:Viewport>
    </body>
    </html>
    When run it, will be show ["foo bar"].join('')
    var _e0=Ext.fly("rootDiv");_e0.insertHtml("afterBegin","[\"<span>foo bar</span>\"].join('')",true);
    I guess this bug is js code has been encoded twice somewhere.
    I use Ext.Net1.6
    Last edited by Daniil; Jan 18, 2013 at 2:33 PM. Reason: [FIXED] [1.7] [2.2]
  2. #2
    Hi @devil,

    Thank you for the report!

    I fixed it locally and will commit to SVN soon. It will appear in the next release (v1.7).

    Also please notice that these methods are designed to be used within AJAX requests (DirectEvent or DirectMethod).

    An element can be just not rendered yet if you call these methods during Page_Load.

    Initially, it would be better to put anything directly to Viewport's Content.
  3. #3
    Quote Originally Posted by Daniil View Post
    Hi @devil,

    Thank you for the report!

    I fixed it locally and will commit to SVN soon. It will appear in the next release (v1.7).

    Also please notice that these methods are designed to be used within AJAX requests (DirectEvent or DirectMethod).

    An element can be just not rendered yet if you call these methods during Page_Load.

    Initially, it would be better to put anything directly to Viewport's Content.
    Thank you for reply!

    I found the bug is in DirectEvent code, but demo code use Page_Load :)

    And I use below code to avoid the issue.

    X.Fly("rootDiv").Dom.Set("innerHTML", html);
    btw: my another bug report http://forums.ext.net/showthread.php...ial-characters has been move to 1.x Help, but I think it's a bug, can you review it? thanks a lot.
  4. #4
    Quote Originally Posted by devil View Post
    I found the bug is in DirectEvent code, but demo code use Page_Load :).
    Ok, understand:)

    Quote Originally Posted by devil View Post
    And I use below code to avoid the issue.

    X.Fly("rootDiv").Dom.Set("innerHTML", html);
    Good. If you will need really add (not just assign) some HTML you can use this code:
    X.Fly("rootDiv").Call("insertHtml", InsertPosition.AfterBegin, new JRawValue(Element.ConvertToSafeJSHtml("<span>foo bar</span>")));


    Quote Originally Posted by devil View Post
    btw: my another bug report http://forums.ext.net/showthread.php?23077-FormPanel-getForm()-getValues()-don-t-encode-xml-special-characters has been move to 1.x Help, but I think it's a bug, can you review it? thanks a lot.
    Yes, we discussed with @Baidaly this issue and decided to move out from the Bugs forum.

    Certainly, we will review your followup posts and will do our best. Don't worry:)
  5. #5
    Quote Originally Posted by Daniil View Post
    Yes, we discussed with @Baidaly this issue and decided to move out from the Bugs forum.

    Certainly, we will review your followup posts and will do our best. Don't worry:)
    Thank you!

Similar Threads

  1. RadioGroup generate dynamic
    By rafaelarosario in forum 2.x Help
    Replies: 0
    Last Post: Jan 11, 2013, 11:38 AM
  2. Menu generate problem
    By Juen in forum 2.x Help
    Replies: 2
    Last Post: Oct 29, 2012, 8:43 PM
  3. MVC Razor – Dynamically generate view
    By Ishrath in forum 2.x Help
    Replies: 0
    Last Post: Oct 11, 2012, 3:54 AM
  4. [CLOSED] generate ComboBox
    By rnfigueira in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Jun 29, 2011, 1:51 PM
  5. Replies: 0
    Last Post: Aug 05, 2009, 9:48 AM

Posting Permissions