Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Scott Bailey on Nov 24, 2009 03:59
open dhtmlx forum
Referring to Accordion cell on a tabbar within a window

Hello,

I am am having problems updating a cell in an accordion. We create a window which has a tabbar inside and an accordion on each tab. The accordion cell we are trying to update is initially populated by attaching a URL. We then want a function to repopulate this cell by attaching a new URL - however I don't seem to be able to refer to the Accordions ID.

This is the function that creates the window with the tabs and accordions
[code]
function processc(esn,perpage,GoPage,nextPrev,theDate){
if(dhxWins.window('recordcard')){dhxWins.window('recordcard').close();}

var win2=dhxWins.createWindow("recordcard",150,10,700,570);
win2.setText("Record Card");
win2.attachObject("w_tabbar");wtabbar=new dhtmlXTabBar("w_tabbar");
wtabbar.setImagePath("dhtmlxSuite/dhtmlxTabbar/codebase/imgs/");
wtabbar.setStyle("winScarf");
wtabbar.addTab("asset","Asset","225px");
wtabbar.addTab("device","Device","225px");
wtabbar.addTab("rcdata","Location","225px");
wtabbar.setContent("asset","assetdiv");
wtabbar.setContent("device","devdiv");
wtabbar.setContent("rcdata","datadiv");
wtabbar.setTabActive("asset");

var dhxAccord2=new dhtmlXAccordion("assetdiv","aqua_orange");
dhxAccord2.setIconsPath("dhtmlxSuite/dhtmlxAccordion/codebase/imgs/dhxaccord_aqua_orange/");
dhxAccord2.addItem("details","Details");
dhxAccord2.addItem("vor","VOR Schedule");
dhxAccord2.addItem("alerts","Alerts");
dhxAccord2.addItem("history","Asset History");
dhxAccord2.addItem("camdata","Asset Data");
dhxAccord2.cells("details").attachObject("detailscard");
dhxAccord2.cells("vor").attachObject("vordetails");
dhxAccord2.cells("alerts").attachObject("alerts");
dhxAccord2.cells("history").attachObject("history");
dhxAccord2.cells("camdata").attachURL("tmxdata.php?esn="+esn+"&rnd="+Math.random());
dhxAccord2.setEffect(false);

var dhxAccord3=new dhtmlXAccordion("devdiv","aqua_orange");
dhxAccord3.setIconsPath("dhtmlxSuite/dhtmlxAccordion/codebase/imgs/dhxaccord_aqua_orange/");
dhxAccord3.addItem("devdetails","Device Details");
dhxAccord3.addItem("devconfig","Assign/Unassign Device");
dhxAccord3.addItem("devhistory","Device History");
dhxAccord3.addItem("devdata","Device Data");
dhxAccord3.cells("devdetails").attachObject("devicecard");
dhxAccord3.cells("devconfig").attachObject("configcard");
dhxAccord3.cells("devhistory").attachObject("devhistory")
dhxAccord3.cells("devdata").attachURL("tmxdatadev.php?esn="+esn+"&rnd="+Math.random());
dhxAccord3.setEffect(false);

var dhxAccord4=new dhtmlXAccordion("datadiv","aqua_orange");
dhxAccord4.setIconsPath("dhtmlxSuite/dhtmlxAccordion/codebase/imgs/dhxaccord_aqua_orange/");
dhxAccord4.addItem("lochist2","Location History");
dhxAccord4.addItem("locdata","Location Data");
dhxAccord4.cells("lochist2").attachURL("rcmap.php?esn="+esn+"&rnd="+Math.random());
dhxAccord4.cells("locdata").attachURL("tmxdataloc.php?esn="+esn+"&rnd="+Math.random());
dhxAccord4.setEffect(false);


dhxWins.window("recordcard").attachEvent("onClose",function(win2){var p=document.getElementById("holders");
var newDiv=document.createElement("div");newDiv.id='detailscard';newDiv.style.background="#FFEECC";newDiv.style.fontFamily="verdana";newDiv.style.fontSize="12px";newDiv.style.width="100%";newDiv.style.height="100%";newDiv.style.textAlign="center";p.appendChild(newDiv);var newDiv2=document.createElement("div");newDiv2.id='vordetails';newDiv2.style.background="#FFEECC";newDiv2.style.fontFamily="verdana";newDiv2.style.fontSize="12px";newDiv2.style.width="100%";newDiv2.style.height="100%";p.appendChild(newDiv2);var newDiv3=document.createElement("div");newDiv3.id='alerts';newDiv3.style.background="#FFEECC";newDiv3.style.fontFamily="verdana";newDiv3.style.fontSize="12px";newDiv3.style.width="100%";newDiv3.style.height="100%";newDiv3.style.textAlign="center";p.appendChild(newDiv3);var newDiv4=document.createElement("div");newDiv4.id='w_tabbar';newDiv4.style.width="100%";newDiv4.style.height="100%";p.appendChild(newDiv4);var newDiv5=document.createElement("div");newDiv5.id='assetdiv';newDiv5.style.background="#FFEECC";newDiv5.style.fontFamily="verdana";newDiv5.style.fontSize="12px";newDiv5.style.width="100%";newDiv5.style.height="100%";p.appendChild(newDiv5);var newDiv6=document.createElement("div");newDiv6.id='devdiv';newDiv6.style.background="#FFEECC";newDiv6.style.fontFamily="verdana";newDiv6.style.fontSize="12px";newDiv6.style.width="100%";newDiv6.style.height="100%";p.appendChild(newDiv6);var newDiv7=document.createElement("div");newDiv7.id='devicecard';newDiv7.style.background="#FFEECC";newDiv7.style.fontFamily="verdana";newDiv7.style.fontSize="12px";newDiv7.style.width="100%";    newDiv7.style.height="100%";newDiv7.style.textAlign="center";p.appendChild(newDiv7);var newDiv8=document.createElement("div");newDiv8.id='configcard';newDiv8.style.background="#FFEECC";newDiv8.style.fontFamily="verdana";newDiv8.style.fontSize="12px";newDiv8.style.width="100%";newDiv8.style.height="100%";newDiv8.style.textAlign="center";p.appendChild(newDiv8);

var newDiv10=document.createElement("div");
newDiv10.id='history';
newDiv10.style.background="#FFEECC";
newDiv10.style.fontFamily="verdana";
newDiv10.style.fontSize="12px";
newDiv10.style.width="100%";
newDiv10.style.height="100%";
newDiv10.style.padding="10px";
newDiv10.style.textAlign="left";
p.appendChild(newDiv10);


var newDiv11=document.createElement("div");
newDiv11.id='devhistory';
newDiv11.style.background="#FFEECC";
newDiv11.style.fontFamily="verdana";
newDiv11.style.fontSize="12px";
newDiv11.style.width="100%";
newDiv11.style.height="100%";
newDiv11.style.padding="10px";
newDiv11.style.textAlign="left";
p.appendChild(newDiv11);


var newDiv12=document.createElement("div");
newDiv12.id='datadiv';
newDiv12.style.background="#FFEECC";
newDiv12.style.fontFamily="verdana";
newDiv12.style.fontSize="12px";
newDiv12.style.width="100%";
newDiv12.style.height="100%";
newDiv12.style.padding="0px";
newDiv12.style.textAlign="left";
p.appendChild(newDiv12);

var newDiv13=document.createElement("div");
newDiv13.id='lochist2';
newDiv13.style.background="#FFEECC";
newDiv13.style.fontFamily="verdana";
newDiv13.style.fontSize="12px";
newDiv13.style.width="100%";
newDiv13.style.height="100%";
newDiv13.style.padding="0px";
newDiv13.style.textAlign="left";
p.appendChild(newDiv13);

var newDiv14=document.createElement("div");
newDiv14.id='camdata';
newDiv14.style.background="#FFEECC";
newDiv14.style.fontFamily="verdana";
newDiv14.style.fontSize="12px";
newDiv14.style.width="100%";
newDiv14.style.height="100%";
newDiv14.style.padding="0px";
newDiv14.style.textAlign="left";
p.appendChild(newDiv14);

var newDiv15=document.createElement("div");
newDiv15.id='ebshistory';
newDiv15.style.background="#FFEECC";
newDiv15.style.fontFamily="verdana";
newDiv15.style.fontSize="12px";
newDiv15.style.width="100%";
newDiv15.style.height="100%";
newDiv15.style.padding="0px";
newDiv15.style.textAlign="left";
p.appendChild(newDiv15);

return true;});var atab=tabbar.getActiveTab();if(atab=="cal" || document.getElementById('vorstate').value=="yes"){dhxAccord2.cells("vor").open();}else{dhxAccord2.cells("details").open();}dhxAccord3.cells("devdetails").open();dhxAccord4.cells("lochist2").open();process2(esn,perpage,GoPage,nextPrev,theDate);}
[/code]

then on the rcmap.php we have the following function

[code]
parent.getmultipos($esn,$id,document.getElementById('positions').value)
[/code]

which calls the function from the main page.
[code]
function getmultipos(esn, pacno,positions)
{
dhxAccord4.cells("lochist2").attachURL("getmultimap.php?esn="+esn+"&pacno="+pacno+"&positions="+positions+"&rnd="+ Math.random(), true);
}
[/code]

but we get the error dhxAccord4 is not defined.

How do I refer to this cell correctly with this set up?

Many thanks
Scott Bailey
Answer posted by Alex (support) on Nov 24, 2009 05:42

Hello,

dhxAccord4 isn't declared as public variable.

To solve the problem try to use:

dhxAccord4=new dhtmlXAccordion("datadiv","aqua_orange");

instead of

var dhxAccord4=new dhtmlXAccordion("datadiv","aqua_orange");

Answer posted by Scott Bailey on Nov 24, 2009 09:14
Many thanks that solved the problem.