Em Wed, 04 Feb 2009 15:23:41 -0300, wesleywj2 <wesley...@yahoo.co.uk> escreveu:

hi thiago,

Hi again!

i've added the configuration inside my AppModule for the javascript:
i 've actually implemented the tree inside my class,

@AfterRender
    public void afterRender() {
                        String jsString = "";
                        jsString += "Event.observe(window,'load',function(){";
                        jsString += " treeObj = new JSDragDropTree(); ";
                        jsString += " treeObj.setTreeId('bststruct'); ";
                        jsString += " treeObj.setImageFolder('../images/'); ";
                        jsString += " treeObj.setRenameAllowed(false); ";
                        jsString += " treeObj.setDeleteAllowed(false); ";
                        jsString += " treeObj.initTree(); ";
            renderSupport.addScript(String.format(jsString));
    }

Seems ok.

next is what about in the tml page?

Nothing! You should see you Javascript code added to a <script> tag inside the page.

<t:Tree treeid='literal:bststruct' source="treeNodes" currentNode="node">
                        <t:actionlink t:id="tree" context="node.identifier">
                                ${node.name}
                        </t:actionlink>
                        </t:Tree>

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

You should never use a script tag to include Javascript in your .tml file. That's what renderSupport.addScript() does, but it does in the right place. ;)

--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

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

Reply via email to