You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Daniel Jue <te...@gmail.com> on 2007/08/28 19:16:28 UTC

T5 Tree Component javascript and DOM

It figures that I would run into this problem.  Placing the Tree Component's
java script block, as seen on the wiki, can cause Abort errors on IE (tested
ie6) because it's modifying the DOM before it is loaded all the way.  (I am
using a larger, complex page to experience these errors)  My page probably
has 30-40 components on it, and the Tree I have is right in the middle of
that stack.

To remedy the problem, I put the 7 lines of javascript code at the bottom of
my border component, to make sure it always goes last.

<script type="text/javascript">
                treeObj = new JSDragDropTree();
                treeObj.setTreeId('reporttree');
                treeObj.setImageFolder('/IEIS2/images/tree/');
                treeObj.setRenameAllowed (false);
                treeObj.setDeleteAllowed(false);
                treeObj.initTree();
                treeObj.expandAll();
</script>


But for pages that don't have a tree on them, I get a script error because
JSDragDropTree is undefined.

Does anyone have a better solution for this?  This must have been solved
elsewhere...
Is there a hook in prototype we can use for making things run after the DOM
is complete?  The problem doesn't happen with Firefox 2.

Re: T5 Tree Component javascript and DOM

Posted by Josh Canfield <jo...@thedailytube.com>.
> Does anyone have a better solution for this?  This must have been solved
> elsewhere...
> Is there a hook in prototype we can use for making things run after the DOM
> is complete?  The problem doesn't happen with Firefox 2.
>

Off the top of my head I would suggest adding your javascript to the
onload event.

Event.observe( window, 'load', function() {
  // Put the Javascript that needs to happen when the page
  // loads here
} );

On 8/28/07, Daniel Jue <te...@gmail.com> wrote:
> It figures that I would run into this problem.  Placing the Tree Component's
> java script block, as seen on the wiki, can cause Abort errors on IE (tested
> ie6) because it's modifying the DOM before it is loaded all the way.  (I am
> using a larger, complex page to experience these errors)  My page probably
> has 30-40 components on it, and the Tree I have is right in the middle of
> that stack.
>
> To remedy the problem, I put the 7 lines of javascript code at the bottom of
> my border component, to make sure it always goes last.
>
> <script type="text/javascript">
>                treeObj = new JSDragDropTree();
>                treeObj.setTreeId('reporttree');
>                treeObj.setImageFolder('/IEIS2/images/tree/');
>                treeObj.setRenameAllowed (false);
>                treeObj.setDeleteAllowed(false);
>                treeObj.initTree();
>                treeObj.expandAll();
> </script>
>
>
> But for pages that don't have a tree on them, I get a script error because
> JSDragDropTree is undefined.
>
> Does anyone have a better solution for this?  This must have been solved
> elsewhere...
> Is there a hook in prototype we can use for making things run after the DOM
> is complete?  The problem doesn't happen with Firefox 2.
>


-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org