Hi,
I have a question regarding the use of dijit.TitlePane. I am using TitlePane with contents loading remotely via href.
<div dojoType="dijit.TitlePane" title="Test TitlePane" open="false" href="test.html">
</div>
When I open this title pane, contents from test.html are loaded. The contents in test.php may contains some Javascript code, which I want to be executed when the contents load. Is there a way to do that in Dijit system.
To give an example, if test.php contains:
<!--start of test.html -->
<script type="text/javascript">
alert('hello');
</script>
Hello World!
<!--end of test.html -->
Then I want the title pane to display the string 'Hello World!' and also show the alert popup when I open it. Please let me know if there is a way to do so.
thanks
Nilesh

I am not sure if this is
I am not sure if this is what you are looking for, because the script is not actually in test.html, but I solved a similar problem by connecting the toggle event to a function:
function yourToggleFunction() {
alert("hello");
}
thanks. however there are
thanks. however there are two things missing:
1. I want the JS to be executed only once when the contents from the remote href location load, instead of at every toggle of the titlepane.
2. It is important for the JS to be in the content loaded from remote location. This is because, the contents of the titlepane including the JS computed on fly based on the user query input. So the JS changes based on user input, and I can not really put it in a common application.js file.
Any help will be greatly appreciated.
thanks
Nilesh
dojox.TitlePane
It's pretty easy to make your own dojox.TitlePane that uses dojox.layout.ContentPane (instead of dijit.layout.ContentPane) - this way your TitlePane can have an href that executes scripts.
Basically copy dijit.TitlePane into the dojox directory and do a couple search/replaces. If you need assistance I can post my version here.
Josh
I know you can execute
I know you can execute scripts in a dojox.layout.ContentPane, but not a TitlePane.
What if you load the remote page in the dojox ContentPane and put the dojox Content Pane in the TitlePane?
Thanks. I will look into it.
Thanks. I will look into it. One question: will dijit ContentPane be replaced by feature-rich dojox version in future??
I am not a dojo developer
I am not a dojo developer but I think it will remain as is for a while. I think the decision to remove script support from dijit.layout.ContentPane was pretty deliberate, hence the need for dojox.layout.ContentPane. But, this is certainly a common issue many people are running into with dojo1.x so who knows?
Josh
Okay. Any reasons why that
Okay. Any reasons why that decision was made (performance? pointers to mailing list discussion). Personally, having scripts in content pane is on top of my wish list for dojo toolkit.
Created a new Custom Widget
I finally managed to create a new widget TitlePaneX.
http://www.blogscope.net/experiments/testTitlePaneX.jsp
http://www.blogscope.net/js/dojo/blogscope/TitlePaneX.xd.js
I will do some more testing, and everything is fine, I will start using it in production.