tags:

views:

30

answers:

2

Hi All,

I have a standalone html page that contains a dojo DataGrid that works just fine. I am including the relevant code below.


    <script type="text/javascript">
    var readStore, grid;
      var gridLayout = [
      new dojox.grid.cells.RowIndex({ name: "Row #", width: 5, styles: "text-align: left;" }),
      {
        name: "Name",
        field: "name",
        styles: "text-align:right;",
        width:30
      },
      {
        name: "Type",
        field: "type",
        width:20
      }
    ];
   function initGrid()
   {
     readStore=new dojox.data.QueryReadStore({url:"/EG3/orgUnit/getChildren",  requestMethod:"get"});
console.info("readStore initialized");

grid=new dojox.grid.DataGrid({store:readStore,
  id:"grid",
  delayScroll:true,
  structure:gridLayout,
  query:{id:2},
  loadingMessage:"Loading..."
}, document.createElement('div'));

dojo.byId("gridContainer").appendChild(grid.domNode);
grid.startup();
 }
  dojo.addOnLoad(initGrid);
</script>

</HEAD>
<BODY class="claro">
<div id="list" class="list">
  Table goes here
 <div id="gridContainer">
 </div>
</div>

Now, the problem happens when I try to include this page as a contentpane within a TabContainer. The TabContainer loads the page markup as is and does not fire the onLoad script of the page that contains the grid.

                  <div dojoType="dijit.layout.TabContainer" region="center" tabStrip="true" id="orgUnitTabs">
                <div dojoType="dojox.layout.ContentPane" title="Info" selected="true" id="orgInfo" jsId="orgInfo">

                </div>
                <div dojoType="dojox.layout.ContentPane" href="/EG3/app/orgUnit/orgUnitChildren.gsp" executeScripts="true" parseOnLoad="true" extractContent="true" title="Children" id="children" jsId="children">
                    Children of the selected Org
                    <script type="javascript" event="onLoad">
                     initGrid();
                    </script>
                </div>

Any ideas on how the onLoad script of the child page can be fired?

Thanks in advance.

A: 

Not sure what the right answer is, but if I were you, I would try doing it all programatically instead of declaratively, trap errors, use console outputs to see what's happening and log events as it loads.

Bal
Thanks for your responses. I did the set the executeScripts to true, but that did not make any difference. I finally got a working solution though. The only way it really worked for me is to wrap the javascript in the child page in another contentpane and make the scripttype="dojo/method".
A: 

you should check if the param executeScripts set to TRUE, and if you wanna use declarative method, you have to parse the domNode manually, see the detailed dojo.parse method:http://docs.dojocampus.org/dojo/parser

Darktalker