Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Nerea on Nov 24, 2008 01:42
open dhtmlx forum
Load a page with toolbar

I have a page with a toolbar. From this page in a div I load a new php page cointaing another toolbar but this second toolbar doesn't load.
Is there a way to load the two toolbars in the same page from different pages?

Thanks a lot.
Answer posted by Support on Nov 24, 2008 03:58
For the moment you can place two or more toolbars on the page.
Could you please provide us your source code/demo?
Answer posted by Nerea on Nov 24, 2008 07:14

Here it goes! I've put a grid and it also doesn't work... I'm able  to see only the tool bar from the main page.

Main.php:

<?
error_reporting(E_ALL);
?>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
 <title>Initializing from XML</title>
 <script type="text/javascript" src="js/dhtmlxcommon.js"></script>
 <script type="text/javascript" src="js/dhtmlxtoolbar.js"></script>
 <link rel="stylesheet" type="text/css" href="css/dhtmlxtoolbar_dhx_blue.css"></link>
</head>

<script language="javascript">
function nuevoAjax(){
var xmlhttp=false;
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }

if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
  xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
}


function cargarContenido(page){
var contenedor;
contenedor = document.getElementById('contenedor');
ajax=nuevoAjax();
ajax.open("GET", page,true);
ajax.onreadystatechange=function() {
if (ajax.readyState==4) {
contenedor.innerHTML = ajax.responseText
}
}
ajax.send(null)
}

</script>
 

<body>
 <div id="toolbarObj"></div>
<script>
 var webBar = new dhtmlXToolbarObject("toolbarObj");
 webBar.setIconsPath("img/");
 webBar.loadXML("xml/dhtmlxtoolbar.xml?etc="+new Date().getTime());
 webBar.attachEvent("onClick", function(id){  
  switch(id){
  case "1_1":
   
  break;

  case "1_2":

  break;

  case "1_3":

  break;

  case "1_4":
 
  break;  
  
  case "2_1":   //Fichero Clientes
   cargarContenido("ficheroClientes.php?etc="+new Date().getTime());
  break;  
  }
 
  });

</script>
<BR>


<div id="contenedor"></div>

</body>
</html>

ficheroClientes.php

<?
error_reporting(E_ALL);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
 <title>Initializing from XML</title> 
 <link rel="stylesheet" type="text/css" href="css/dhtmlxtoolbar_dhx_blue.css"></link>
 <link rel="STYLESHEET" type="text/css" href="css/dhtmlxgrid.css">
 <link rel='stylesheet' type='text/css' href='css/style.css'>
 <script type="text/javascript" src="js/dhtmlxcommon.js"></script>
 <script type="text/javascript" src="js/dhtmlxtoolbar.js"></script> 
 <script type="text/javascript" src="js/dhtmlxgrid.js" ></script>
 <script type="text/javascript" src="js/dhtmlxgridcell.js"></script>
 <script type="text/javascript" src="js/dhtmlxgrid_srnd.js"></script>
 
</head>
 
<body onLoad="cargarGrid();">

<script>

//Patch for taborder in grid
 dhtmlXGridObject.prototype._init_point_key_patch=dhtmlXGridObject.prototype._init_point;
 dhtmlXGridObject.prototype._init_point = function(){
 this._nextRow=function(ind, dir){
  var r = this.render_row(ind+dir);
  if (!r || r==-1) return null;
  if (r&&r.style.display == "none")
   return this._nextRow(ind+dir, dir);

  return r;
 }
 this._init_point=this._init_point_key_patch;
 if (this._init_point) this._init_point();
 }


 function doOnRowDblClicked(rowId){
   return confirm("Row with ID "+ rowId + " was double clicked. Do you want to proceed?");   
      }

 function doOnEnter(rowId){
              return confirm("Row with ID "+ rowId + " was double clicked. Do you want to proceed?");
         }
       
 function cargarGrid(){
   //manual grid destruction si existe la grid

   mygrid = new dhtmlXGridObject("gridbox");
   mygrid.setEditable(true);
   mygrid.setSkin("light");
   //enable tooltips for last column
       mygrid.enableTooltips("false,true"); 
          //moverse entre las filas con el teclado
   mygrid.enableKeyboardSupport(true);  
   //seleccionar fila con dobleclick
   mygrid.attachEvent("onRowDblClicked",doOnRowDblClicked);
   mygrid.attachEvent("onEnter",doOnEnter);   
   //mygrid.setExternalTabOrder("bBuscar","bCalendario");
   //tabulacion
   mygrid.enableEditTabOnly(1);
   //solo se pude seleccionar uno 
   mygrid.enableMultiselect(false);     
       //CArga cada 50 registros   
       mygrid.enableSmartRendering(true,50);     
       //cargar fichero 
   mygrid.loadXML("gridClientes.php");
 }


</script>
<P>Fichero Clientes</P>
<div id="toolbarMenu"></div>
<script>
 var webBar = new dhtmlXToolbarObject("toolbarMenu");
 webBar.setIconsPath("img/");
 webBar.loadXML("xml/clientes.xml?etc="+new Date().getTime());
 webBar.attachEvent("onClick", function(id){  
  switch(id){
  case "1_1":
   
  break;

  case "1_2":

  break;
  }
 
  });

</script>
<div id="gridbox" style="height:345px;width:411px;background-color:white;overflow:hidden;"></div> 

</body>
</html>

 

 


Answer posted by Support on Nov 25, 2008 01:48
In your code you attaching new page into div. In this case scripts won't be executed.
<body onLoad="cargarGrid();"> <--- this won't be executed too.
At least you need to execute function which will call necessary methods which will construct objects.