Home All Groups Group Topic Archive Search About

OnDocumentReady with Treeview HTC (in a popup)

Author
19 Sep 2006 2:20 PM
dgl3906464
All,
   I've seeing a very odd behavior:
   I've got a treeview control (implemented with treeview.htc) that
renders fine.
   If I put that treeview on a page, it renders and behaves normally.
   If I put that treeview into a popup (created with
window.createPopup()), it renders fine, but the onDocumentReady event
never fires. onContentReady does, but onDocumentReady does not?
   What's that leave me? A treeview that renders with no events
attached?

Very very odd.

<HTML><!-- XMLNS:mytree>-->
<head>
<!--  <?IMPORT NAMESPACE="mytree" IMPLEMENTATION="treeview.htc"/> -->
  <title>TreeCwbs</title>
  <script>
    function makePopup(x,y){
     var oCWBSPopup
     if(!window.oCWBSPopup) {
       oCWBSPopup = window.createPopup();
       oCWBSPopup.document.body.style.border="2px white window-inset";

       // as you can see, we're making a poup with an embedded treeview
       // using write, we can set the namespace and perform an import
       // directive - remember that these elements are not in the DOM
       // and are not scriptable. The tree RENDERS fine, but never
       // attaches events, and the onDocumentReady event never fires.

       var popupBody[0] = '<HTML XMLNS:mytree><HEAD>';
       popupBody[1] = '<?IMPORT NAMESPACE="mytree" ';
       popupBody[2] = '   IMPLEMENTATION="treeview.htc"/>';
       popupBody[3] = '</HEAD><BODY>';
       popupBody[4] = '<mytree:treeview id="tree1" ';
       popupBody[5] = '   TreeNodeSrc="template.xml" ';
       popupBody[6] = '   TreeNodeXsltSrc="template.xsl" />';
       popupBody[7] = '</BODY></HTML>';
       oCWBSPopup.document.write(popupBody.join(''));
       window.oCWBSPopup = oCWBSPopup;
     } else
       oCWBSPopup = window.oCWBSPopup;
     oCWBSPopup.show(x-5,y-5,500,300,document.body);
   }
  </script>
</HEAD>
<body>
  <form id="Form1" method="post" runat="server">
    <span onclick="makePopup(event.x,event.y);" >
     <img src="images/folder.gif"/>
    </span><br/>

<!-- When the HTML comment blocks are
  un-commented, the regular treeview below
  works fine -->
<!--
    <mytree:treeview id="tree1"
            TreeNodeSrc="template.xml"
            TreeNodeXsltSrc="template.xsl" /> -->
  </form>
</body>
</HTML>

Suggestions?

-Daniel

Author
19 Sep 2006 10:14 PM
dgl3906464@gmail.com
All - here's an edited version that should be easier to play with:

<HTML><!-- XMLNS:mytree>-->
<head>
<!--  <?IMPORT NAMESPACE="mytree" IMPLEMENTATION="treeview.htc"/>-->
  <title>TreeCwbs</title>
  <script>
    function makePopup(x,y){
     var oCWBSPopup
     if(!window.oCWBSPopup) {
       oCWBSPopup = window.createPopup();
       oCWBSPopup.document.body.style.border="2px white window-inset";

       // as you can see, we're making a poup with an embedded treeview
       // using write, we can set the namespace and perform an import
       // directive - remember that these elements are not in the DOM
       // and are not scriptable. The tree RENDERS fine, but never
       // attaches events, and the onDocumentReady event never fires.

       var popupBody=new Array(10);
       popupBody[0] = '<HTML XMLNS:mytree><HEAD>';
       popupBody[1] = '<?IMPORT NAMESPACE="mytree" ';
       popupBody[2] = '   IMPLEMENTATION="treeview.htc"/>';
       popupBody[3] = '</HEAD><BODY>';
       popupBody[4] = '<mytree:treeview id="tree1" >';
       popupBody[5] = '   <mytree:treenode text="a">';
       popupBody[6] = '    <mytree:treenode text="b"/>';
       popupBody[7] = '   </mytree:treenode>';
       popupBody[8] = '</mytree:treeview>';
       popupBody[9] = '</BODY></HTML>';
       oCWBSPopup.document.write(popupBody.join(''));
       window.oCWBSPopup = oCWBSPopup;
     } else
       oCWBSPopup = window.oCWBSPopup;
     oCWBSPopup.show(x-5,y-5,500,300,document.body);
   }
  </script>
</HEAD>
<body>
  <form id="Form1" method="post" runat="server">
    <span onclick="makePopup(event.x,event.y);" >
     <img src="images/folder.gif"/>
    </span><br/>

<!-- When the HTML comment blocks are
  un-commented, the regular treeview below
  works fine -->
<!--
    <mytree:treeview id="tree1" >';
        <mytree:treenode text="a">';
            <mytree:treenode text="b"/>';
        </mytree:treenode>';
    </mytree:treeview>-->
  </form>
</body>
</HTML>