javascript contents are not getting loaded,if i create a tab/contentPane dymaically with .xhtml as input

StackOverflow https://stackoverflow.com/questions/16214583

Domanda

I am creating a dynamic tab/contentPane as below in home.xhtml file and i am trying to call a function display which is present in order.xhtml,its not getting called. what ever java script is there in order.xhtml is not getting loaded.

In home.xhtml

    if(dijit.byId('ordersummary')!=null){
        dijit.byId('ordersummary').destroy();
        }
    newTab= new dijit.layout.ContentPane({
        id : 'ordersummary',
        title : 'Order Summary',
        href : 'order.xhtml',
        closable : true
    });
    dijit.byId('tabContainer').addChild(newTab);
     dijit.byId('tabContainer').selectChild(dijit.byId("ordersummary"));

javascript in order.xhtml

<script type="text/javascript">
    //<![CDATA[
    function display(){
      alert(" I M BEING CALLED");
             }
     </script>
È stato utile?

Soluzione

There are two ways about this, either a make the script type dojo/method. Or use the extended dojox/layout/ContentPane.

http://livedocs.dojotoolkit.org/dijit/layout/ContentPane#executing-javascript-inside-contentpane

Altri suggerimenti

While I'm not familiar with the dojo toolkit, I think you should put the JavaScript function in the main file or load the JavaScript dynamically like; How do I include a JavaScript file in another JavaScript file?

dijit.layout.ContentPane will not support javascript,i mean it will not execute the javascript content in the input file.

dojox.layout.ContentPane is advanced one and it will support javascript.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top