Attach Component to Hyperlinks inside iframe (via attchURL)?

How to Attach Components to Hyperlinks inside the iframe Window fetched by attachURL?

#1.
I am calling a page via attachURL inside an Window. [working fine]
This page gives me a listing of several items fetched from the db.

#2.
I want to attach these items with the Tabbar so that clicking on any one of these items will open a new Tabbar in the parent window where I shall show via dhtmlxgrid the related data for that clicked item.

Eg. [product1] [product2] … [productn]
Clicking on each, should openup a Tabbar in the parent window.
Therein, I want to call dhtmlxgrid to display details of the products.

Basic issue is:
– How to attach the Tabbar Component to the Items (products) / hyperlinks?

To access the parent window you may use parent object as the page in loaded into an iframe. If the iframe page is from the same domain as the parent window, you may also access the element of this page from the parent. The iframe object can be got by the getFrame method:

var ifr = win.getFrame();

Where win is the dhtmlx window.

Hi, Thanks for the reply. Pls see this case:

<html><head>
<script>somescript</script>
</head>
<body>
<a href="#" onClick(something)>[Product1]</a> <!-- this should Create a New TabBar dynamically in the parent window and load grid-->

<a href="#" onClick(something)>[Product2]</a> <!-- this should Create a New TabBar dynamically in the parent window and load grid -->
</body>
</html>

Can you provide codes for ‘something’ and ‘somescript’?
‘something’ should Create a New TabBar dynamically in the parent window and load grid .
‘something’ is activated on onClick function of a div or tag.
‘somescript’ is the script I am looking forward to you to write to enable ‘something’ to do its action as above.

Assume that the Parent window has some Tabbars x dhtmlxgrid created.

The following is the code used to call the above window.

//logic to open new window here
createfolder = dhxWins.createWindow("create", 100, 30, 900, 550);
createfolder.setText("Products");
//w1.center();
createfolder.button("close");
createfolder.attachURL("grid_display_main_products.php");
 
createfolder.attachEvent("onClose",function(){
// --noOfCreateFolderWinsOpen;
 // close();
return true;
});

Thanks!

It is not clear are you asking about Tabbar (component) or tab (the item in Tabbar).

If addNewTab function is defined the parent page, you may call it from the grid_display_main_products.php as follows:

[Product1]

How to add a new tab and attach Grid in it you may learn in the tabbar samples:

dhtmlx.com/docs/products/dht … eting.html

dhtmlx.com/docs/products/dht … nside.html

Thanks for your help but sorry it did not work.
This work is so urgent now and I am so stuck!

Here is the full code:

<script language="javascript" type="text/javascript">
 
		var layout,menu,toolbar,contactsGrid,contactsGridZ,contactsGridA,contactsGridB,contactForm;
		dhtmlx.image_path = "codebase/dhtmlx_std_full/imgs/";

		dhtmlxEvent(window,"load",function(){
		
			// TABBAR
			tabbar = new dhtmlXTabBar(document.getElementById("a_tabbar"), "top");
			tabbar.setSkin('dhx_skyblue'); 
			//tabbar.enableTabCloseButton("true");
			//tabbar.setOnTabClose(doOnTabClose);
			
			//tabbar.setImagePath("../../codebase/imgs/");

			// tabbar.addTab("a1", "#1 English Taster Movie", "200px");
			tabbar.addTab("a1", "Lead Form", "200px");			
			tabbar.addTab("a2", "8 Minute Movie", "200px");
			tabbar.addTab("a3", "Business Presentation", "300px");
			tabbar.addTab("a4", "HomePage", "200px");			

			tabbar.setTabActive("a1");

			// var Ta=tabbar.cells("a1");		// English Taster Movie
 			var Tb=tabbar.cells("a1");		// Lead Form - Step2
			var Tc=tabbar.cells("a2");		// 8 Minute Movie
			var Td=tabbar.cells("a3");		// Business Overview 
			var Te=tabbar.cells("a4");		// HomePage - Step5
			
			
			/*			 	
 			tabbar.attachEvent("onSelect", function(id) {
				var tab=tabbar.getActiveTab();
	 			if(tab!=id){
					if(id=="y"){
						 x=tabbar.cells("a1");
					}
				}
					//alert("xxx: "+tab);
				tabbar.setTabActive("a1"); 
				reloadgrid();
			});	 */	
			
			/*
			var x=tabbar.cells("a1").attachLayout("3L");
				
			x.cells("a").setText("All Prospects: [Click on Column Names to Sort]");
			x.cells("b").setText("Notes");
			x.cells("c").setText("Contact Details");	
			x.cells("a").setWidth("700");					
 
 			x.cells("c").attachURL("index.html");
 			*/
			//layout
	 
			
			// MENU
			/*
			menu = layout.attachMenu();
			menu.setIconsPath("codebase/dhtmlx_std_full/icons/");
			menu.loadXML("codebase/dhtmlx_std_full/xml/menu.xml");	
			*/
			
			// TOOLBAR
			//toolbar = x.cells("a").attachToolbar();

/* 			
 			// TOOLBAR 1
			toolbar2 = Ta.attachToolbar();
			toolbar2.setIconsPath("codebase/dhtmlx_std_full/icons/");			
			toolbar2.loadXML("codebase/dhtmlx_std_full/xml/toolbar.xml?"+ new Date().getTime());				 			
			toolbar2.attachEvent("onClick", doOnToolbarClick);	
			*/

			// TOOLBAR 2
			toolbar = Tb.attachToolbar();
			toolbar.setIconsPath("codebase/dhtmlx_std_full/icons/");			
			toolbar.loadXML("codebase/dhtmlx_std_full/xml/toolbar.xml?"+ new Date().getTime());				 			
			toolbar.attachEvent("onClick", doOnToolbarClick);
 			//toolbar.preventIECaching(true);
		
						
			// TOOLBAR 3
			toolbar3 = Tc.attachToolbar();
			toolbar3.setIconsPath("codebase/dhtmlx_std_full/icons/");			
			toolbar3.loadXML("codebase/dhtmlx_std_full/xml/toolbar.xml?"+ new Date().getTime());				 			
			toolbar3.attachEvent("onClick", doOnToolbarClick);	
			
			// TOOLBAR 4
			toolbar4 = Td.attachToolbar();
			toolbar4.setIconsPath("codebase/dhtmlx_std_full/icons/");			
			toolbar4.loadXML("codebase/dhtmlx_std_full/xml/toolbar.xml?"+ new Date().getTime());				 			
			toolbar4.attachEvent("onClick", doOnToolbarClick);										

			// TOOLBAR 5
			toolbar5 = Te.attachToolbar();
			toolbar5.setIconsPath("codebase/dhtmlx_std_full/icons/");			
			toolbar5.loadXML("codebase/dhtmlx_std_full/xml/toolbar.xml?"+ new Date().getTime());				 			
			toolbar5.attachEvent("onClick", doOnToolbarClick);						 
						
						
			// GRID - X
		//	contactsGridY = Ta.attachGrid();	// English Taster Movie				
			contactsGrid = Tb.attachGrid();		// Lead Form - Step2
			contactsGridZ = Tc.attachGrid();	// 8 Minute Movie	
			contactsGridA = Td.attachGrid();	// Business Overview 
			contactsGridB = Te.attachGrid();	// HomePage - Step5
																	
			// contactsGrid = layout.cells("a").attachGrid();
			// sets the path to the grid images
			// mygrid.setImagePath("codebase/dhtmlxGrid/codebase/imgs/");
			// sets the headers of the columns
			contactsGrid.setHeader("#master_checkbox,id,First Name,Last Name,Email,Phone,Notes");
			contactsGridZ.setHeader("#master_checkbox,id,First Name,Last Name,Email,Phone,Notes");
			contactsGridA.setHeader("#master_checkbox,id,First Name,Last Name,Email,Phone,Notes");
			contactsGridB.setHeader("#master_checkbox,id,First Name,Last Name,Email,Phone,Notes");			
														
			// sets the width of the columns; * - the column fills all the available space
			contactsGrid.setInitWidths("50,0,*,*,*,*,*");
			contactsGridZ.setInitWidths("50,0,*,*,*,*,*");
			contactsGridA.setInitWidths("50,0,*,*,*,*,*");
			contactsGridB.setInitWidths("50,0,*,*,*,*,*");			
												

          	//contactsGrid.enableAutoWidth(true);
         	 //contactsGrid.enableAutoHeight(true);
			
			// sets the horizontal alignment of the value in the columns 
			contactsGrid.setColAlign("center,center,left,left,left,center,left");
			contactsGridZ.setColAlign("center,center,left,left,left,center,left");
			contactsGridA.setColAlign("center,center,left,left,left,center,left");	
			contactsGridB.setColAlign("center,center,left,left,left,center,left");												

			// sets the skin of the grid
			contactsGrid.setSkin("dhx_skyblue");
			contactsGridZ.setSkin("dhx_skyblue");
			contactsGridA.setSkin("dhx_skyblue");
			contactsGridB.setSkin("dhx_skyblue");										
			//grid.setStyle(ss_header, ss_grid, ss_selCell, ss_selRow);			
			//contactsGrid.setStyle("background-color:#E3EAF4; font-weight:bold;", "border:#000 1px solid","color:red;");			
			
			// sets the sorting criteria of the columns
			contactsGrid.setColSorting("na,na,str,str,str,str,str");
			contactsGridZ.setColSorting("na,na,str,str,str,str,str");
			contactsGridA.setColSorting("na,na,str,str,str,str,str");	
			contactsGridB.setColSorting("na,na,str,str,str,str,str");	
														
			// sets the types of the columns
			contactsGrid.setColTypes("ch,ro,ro,ro,ro,ro,ro"); 
			contactsGridZ.setColTypes("ch,ro,ro,ro,ro,ro,ro"); 
			contactsGridA.setColTypes("ch,ro,ro,ro,ro,ro,ro"); 	
			contactsGridB.setColTypes("ch,ro,ro,ro,ro,ro,ro"); 												
			
			// Search
			contactsGrid.attachHeader("Search:,,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter");
			contactsGridZ.attachHeader("Search:,,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter");
			contactsGridA.attachHeader("Search:,,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter");	
			contactsGridB.attachHeader("Search:,,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter");												
			
		 	//enable auto width mode
		    contactsGrid.enableAutoWidth(true);
		    contactsGridZ.enableAutoWidth(true);
		    contactsGridA.enableAutoWidth(true);									
		    contactsGridB.enableAutoWidth(true);			
			
		    //enable prevent IE caching mode
		    contactsGrid.preventIECaching(true);
		    contactsGridZ.preventIECaching(true);
		    contactsGridA.preventIECaching(true);	
		    contactsGridB.preventIECaching(true);												

			//contactsGrid.enableMultiselect(true);
		
			// initializes the grid
			contactsGrid.init();	
			contactsGridZ.init();	
			contactsGridA.init();		
			contactsGridB.init();														

			// The SQL part - Connecting to the DATABASE --------------- *******************************************
		//  contactsGridY.load("includes/mycontactsdb_engtaster.php");		// English Taster Movie	 
			contactsGrid.load("includes/mycontactsdb_leadform.php");		// Lead Form - Step2
			contactsGridZ.load("includes/mycontactsdb_8min.php");			// 8 Minute Movie	
			contactsGridA.load("includes/mycontactsdb_bizview.php");		// Business Overview 
			contactsGridB.load("includes/mycontactsdb_home.php");			// HomePage - Step5				 									
			
		//	contactsGridY.attachEvent("onCheck");				
			contactsGrid.attachEvent("onCheck");			
			contactsGridZ.attachEvent("onCheck");		
			contactsGridA.attachEvent("onCheck");	
			contactsGridB.attachEvent("onCheck");															

		//	contactsGridY.attachEvent("onRowSelect",doOnRowSelected);
			contactsGrid.attachEvent("onRowSelect",doOnRowSelected);
			contactsGridZ.attachEvent("onRowSelect",doOnRowSelected);
			contactsGridA.attachEvent("onRowSelect",doOnRowSelected);
			contactsGridB.attachEvent("onRowSelect",doOnRowSelected);								
			
						
		//	contactsGridY.attachEvent("onRowDblClicked", doOnRowDoubleClicked);						
			contactsGrid.attachEvent("onRowDblClicked", doOnRowDoubleClicked);
			contactsGridZ.attachEvent("onRowDblClicked", doOnRowDoubleClicked);
			contactsGridA.attachEvent("onRowDblClicked", doOnRowDoubleClicked);	
			contactsGridB.attachEvent("onRowDblClicked", doOnRowDoubleClicked);												


 
			 
/*			contactsGrid.forEachRow(function(id){
            var cell=contactsGrid.cells(id,INDEX);
            if (cell.isCheckbox()) cell.setValue(1); alert('m');
			});*/
			
			// WINDOWS
			 
			var dhxWins,w1,help;
			dhxWins = new dhtmlXWindows();
			//dhxWins.enableAutoViewport("auto");
			dhxWins.attachViewportTo("a_tabbar");
			//dhxWins.vp.style.border = "#909090 1px solid";
			//dhxWins.setImagePath("../../codebase/imgs/");
			/*
			w1 = dhxWins.createWindow("w1", 340, 20, 320, 240);
			w1.setText("dhtmlxWindow");
			w1.center();
			w1.button("close").disable();
			*/
			//w=w1.attachObject('win_obj');	
			//toolbar.attachWindow('w');	
			 
			
			
			// FUNCTIONS
			
			var noOfWinsOpen=0;	// This checks the no of viewing windows that can be opened at max
			var noOfEditWinsOpen=0;	// This checks the no of editing windows that can be opened at max
			var noOfHelpWinsOpen=0; // Help Window
			var noOfEmailWinsOpen=0; // Email Window
			var noOfNoteWinsOpen=0; // Note Window			
			var noOfCreateFolderWinsOpen=0; // New Create Folder 
			var noOfMoveWinsOpen=0; // Move Record Window
			
			var CurrentTab=tabbar.getActiveTab();
 
			 function doOnRowSelected(rowID,celInd){
				//  alert("Selected row ID is "+rowID+"\nUser clicked cell with index "+celInd);
				 CurrentTab=tabbar.getActiveTab();
					if(CurrentTab=="a1"){
						var cell=contactsGrid.cells(rowID,"1");			
					}else if(CurrentTab=="a2"){
						var cell=contactsGridZ.cells(rowID,"1");			
					}else if(CurrentTab=="a3"){
						var cell=contactsGridA.cells(rowID,"1");	
					}else if(CurrentTab=="a4"){
						var cell=contactsGridB.cells(rowID,"1");									
					}else{
					alert("No Tab Selected");
						return false;
					}				 
					
				 // alert(cell.getValue());
				 var cellvalue=cell.getValue();
				// alert(rowID);
				 // alert(celInd);
				 
				 if(celInd=="6"){
				 	// viewnote(rowID);
					viewnote(cellvalue,rowID);
				 }
			}
			
			 /*function doOnRowDoubleClicked(rowID,celInd){
				 //alert("Selected row ID is "+rowID+"\nUser clicked cell with index "+celInd);
	 			//doOnToolbarClick("viewDetails");
					var id = "a" + rowID;				
					if (tabbar.cells(id) == undefined)
					{
						var title = contactsGrid.cells(rowID,1).getValue();
						var disabled = contactsGrid.cells(rowID,1).getAttribute( "disabled" );
				
						if ( disabled == "1" )
						{
							return;
						}
				
						tabbar.addTab(id,title);
						tabbar.setHrefMode("iframes");
						tabbar.setContentHref(id, "grid_viewdetails.php?pros_id=" + rowID);
					}
					tabbar.setTabActive(id);
	 
			}*/
						
			 function doOnRowDoubleClicked(rowID,celInd){
				 // alert("DSelected row ID is "+rowID+"\nUser clicked cell with index "+celInd);
				
				CurrentTab=tabbar.getActiveTab();
 
				if(celInd!="6"){	  
					// var cell=contactsGrid.cells(rowID,"0");
					if(CurrentTab=="a1"){
						var cell=contactsGrid.cells(rowID,"0");			
					}else if(CurrentTab=="a2"){
						var cell=contactsGridZ.cells(rowID,"0");			
					}else if(CurrentTab=="a3"){
						var cell=contactsGridA.cells(rowID,"0");	
					}else if(CurrentTab=="a4"){
						var cell=contactsGridB.cells(rowID,"0");									
					}else{
					alert("No Tab Selected");
						return false;
					}	
					
					 if (cell.isCheckbox()){
						if(cell.getValue()=="1"){
							//alert("1");
							cell.setValue(0);
						}else{
							//alert("0");
							cell.setValue(1);
						}
					}	
				} 
				 //++noOfWinsOpen;
				 //alert(noOfWinsOpen);
	 			 //doOnToolbarClick('viewDetail');
				 //if (cell.isCheckbox()){cell.setValue(0);}
				 //--noOfWinsOpen;
			}						
						
			function viewnote(cellvalue,rowID){
				// cells(i,j).getAttribute("some");

				var Vurl = "grid_note.php?action=viewnote&&pros_id="+cellvalue;	
					Vurl = Vurl+"&&rs="+(new Date()).valueOf();		
 								
						Vnote = dhxWins.createWindow("note"+(new Date()).valueOf(), 450, 350, 500, 350);
						Vnote.setText("View Note");
						//w1.center();
						Vnote.button("close");
						Vnote.attachURL(Vurl);

			}

			
			
			// Form
			//contactForm=Tb.cells("b").attachForm();
			//contactForm.loadStruct("codebase/dhtmlx_std_full/xml/rowform.xml");
			
			 /*
			
			
			contactsGrid.attachEvent("onRowSelect", function(rID,cInd){
			//alert("Selected row ID is "+rID+"\nUser clicked cell with index "+cInd);
			contactForm.load("codebase/dhtmlx_std_full/xml/contact_details.php?id="+rID);
			})			
			
			
			// DATA PROCESSING
			var dpf = new dataProcessor("codebase/dhtmlx_std_full/xml/contact_details.php");
			dpf.init(contactForm);
			
			dpf.attachEvent("onAfterUpdate",function(sid,action,tid,xml_node){
				contactsGrid.cells(sid,4).setValue(contactForm.getItemValue("notes"));
			})		

*/

			

						
			function doOnToolbarClick(id)
			{
				//alert('doOnToolbarClick: '+noOfWinsOpen);
				//var   checked = contactsGrid.getCheckedRows(0);
				CurrentTab=tabbar.getActiveTab();
 
 				if(CurrentTab=="a1"){
					var   checked = contactsGrid.getCheckedRows(0);			
				}else if(CurrentTab=="a2"){
					var   checked = contactsGridZ.getCheckedRows(0);			
				}else if(CurrentTab=="a3"){
					var   checked = contactsGridA.getCheckedRows(0);			
				}else if(CurrentTab=="a4"){
					var   checked = contactsGridB.getCheckedRows(0);						
				}else{
				alert("No Tab Selected");
					return false;
				}	
				
								
				
				if((id!="help")&&(id!="reload")&&(id!="createNewTab")){
					if ((checked == "" || checked == "none"))
					{
						alert("Please select items before trying to perform this action.");
						return false;
					}
				}
				//alert("TOOL IS"+id);
				 
			   // alert("Checked is "+checked);
				
				
 
				 
					switch (id)
					{
	
						case 'viewDetail':
							   
							if(noOfWinsOpen>=5){
								alert("MAXIMUM Windows for VIEWING DETAILS are open. \n Please Close One or More Windows to View More.");
								return false; 	   
							}	   
							   
						  var url, top, left;
						  var rowId = checked.split(",");
						   //alert(rowId);
						   
						  if(rowId.length>5){
							alert("Please select upto 5 recs for display.");
							return false;
						  }else{
							   var mainUrl = "grid_viewdetails.php?pros_id=";
							   left=200;
							   top=55;
										
							   if(rowId!=null){
									for (i=0; i<rowId.length; i++,++noOfWinsOpen)
									{
										top=top+45;
										left=left+25;
										
										if ( rowId[i] != 0 )
										{
											   //alert(rowId[i]);
												url = mainUrl + rowId[i];
												url = url+"&&rs="+(new Date()).valueOf();
		
												viewDetail = dhxWins.createWindow("viewDetail"+i, left, top, 800, 520);
												viewDetail.setText("View Details");
												//w1.center();
												//viewDetail.progressOn();
												viewDetail.button("close");
												viewDetail.attachURL(url);
												 
												viewDetail.attachEvent("onClose",function(){
													 --noOfWinsOpen;
													 reloadgrid();
													 close(); 
													 
													 return true;
												});
												
												//alert(noOfWinsOpen);
										}				
									}
								}
							}
							break;
	
						case 'editDetail':
						
							if(noOfEditWinsOpen>=1){
								alert("MAXIMUM Windows for EDITING are open. \n Please close the Current Edit Window to edit another record.");
								return false;	
							}					
						
						  var Eurl, Etop, Eleft;
						  var ErowId = checked.split(",");
						   //alert(rowId);
						  
						  if(ErowId.length>1){
							alert("Please select only 1 record for Editing purposes.");
							return false;
						  }else{
							   var EmainUrl = "grid_editdetails.php?pros_id=";
							   Etop=200;
							   Eleft=30;
										
							   if(ErowId!=null){
									for (i=0; i<ErowId.length; i++,++noOfEditWinsOpen)
									{
										Etop=Etop+55;
										Eleft=Eleft+55;
										
										if ( ErowId[i] != 0 )
										{
											// alert(rowId[i]);
												Eurl = EmainUrl + ErowId[i];
												Eurl = Eurl+"&&rs="+(new Date()).valueOf();
		
												editDetail = dhxWins.createWindow("editDetail"+i, Etop, Eleft, 800, 520);
												editDetail.setText("Edit Details");
												//w1.center();
												editDetail.progressOn();
												editDetail.button("close");
												editDetail.attachURL(Eurl);
												editDetail.attachEvent("onClose",function(){
													 --noOfEditWinsOpen;
													 reloadgrid();
													 close(); 
													 return true;
												});												
												
										}				
									}
								}									
							}
	
							break;
	
						case 'addNote':

							var NrowId = checked.split(",");
							var Nurl = "grid_note.php?pros_id="+NrowId+"&action=addnote";	
								Nurl = Nurl+"&&rs="+(new Date()).valueOf();		
														
							if(noOfNoteWinsOpen>0){
								alert("Add Note Window is Already Open.");
								return false; 		
							}					 
							
						  if(NrowId.length>1){
							alert("Please select only 1 record for Adding A Note.");
							return false;
						  }else{
																					 
								for (i=0; i<NrowId[i]; i++,++noOfNoteWinsOpen)
								{										
									note = dhxWins.createWindow("note"+i, 450, 350, 500, 350);
									note.setText("Add Note");
									//w1.center();
									note.button("close");
									note.attachURL(Nurl);
									note.attachEvent("onClose",function(){
											 --noOfNoteWinsOpen;
											 reloadgrid();
											 close(); 
											 return true;
										});	
								}// for
							} // else
	
							break;		
	
	
						case 'moveContact':
							// moveContacts(id);

							var MrowId = checked.split(",");
							var Murl = "grid_moverecord.php?pros_id="+MrowId;	
								Murl = Murl+"&&rs="+(new Date()).valueOf();		
														
							if(noOfMoveWinsOpen>0){
								alert("Move Contacts Window is Already Open.");
								return false; 		
							}					 
							
						  if(MrowId.length>1){
							alert("Please select upto 1 record for Moving a Record.");
							return false;
						  }else{
																					 
								for (i=0; i<MrowId[i]; i++,++noOfMoveWinsOpen)
								{										
									Mnote = dhxWins.createWindow("move"+i, 450, 350, 500, 350);
									Mnote.setText("Move Record");
									//w1.center();
									Mnote.button("close");
									Mnote.attachURL(Murl);
									Mnote.attachEvent("onClose",function(){
											 --noOfMoveWinsOpen;
											 reloadgrid();
											 close(); 
											 return true;
										});	
								}// for
							} // else
								
							
							break;	
					
						case 'delContact':
							var r=confirm('This Action is Permanent: This will DELETE the Record from the Database. \n\n Click OK to Proceed [Delete]. \n\nClicking Cancel will cancel this operation.');
							if(r==true){
							 deleteContacts(checked);
							 }else{
							 alert('Nothing was Deleted');
							 }
							break;
							
						
	
						case 'sendEmail':

							var SErowId = checked.split(",");
							var SEurl = "grid_email.php?pros_id="+SErowId+"&action=sendemail";	
								SEurl = SEurl+"&&rs="+(new Date()).valueOf();		
						
							if(noOfEmailWinsOpen>0){
								alert("EMAIL Window is Already Open");
								return false; 		
							}					 
							 
							for (i=0; i<1; i++,++noOfEmailWinsOpen)
							{							
							// sendEmails(id);
								email_grid = dhxWins.createWindow("email_grid", 200, 30, 800, 520);
								email_grid.setText("Send Email");
								//w1.center();
								email_grid.button("close");
								email_grid.attachURL(SEurl);
								email_grid.attachEvent("onClose",function(){
										 --noOfEmailWinsOpen;
										 reloadgrid();
										 close(); 
										 return true;
									});	
							}
							
							break;	
							
						case 'createNewTab':
						
							if(noOfCreateFolderWinsOpen>0){
								alert("Create Folder Window is Already Open");
								return false; 		
							}					 
							 
							for (i=0; i<1; i++,++noOfCreateFolderWinsOpen)
							{						 
									//logic to open new window here
								createfolder = dhxWins.createWindow("create"+i, 100, 30, 900, 550);
								createfolder.setText("Create Folder");
								//w1.center();
								createfolder.button("close");
								createfolder.attachURL("grid_createfolder.php");
								
				
								//help.attachObject("win_obj");	
								//help.show();
								createfolder.attachEvent("onClose",function(){
										 --noOfCreateFolderWinsOpen;
										 //help.hide();
										 close(); 
										 return true;
									});									
							} // for
 
							break;							
					 
							 
						case 'help':
						 
							if(noOfHelpWinsOpen>0){
								alert("HELP is Already Open");
								return false; 		
							}					 
							 
							for (i=0; i<1; i++,++noOfHelpWinsOpen)
							{						 
									//logic to open new window here
								help = dhxWins.createWindow("help", 100, 30, 900, 550);
								help.setText("Help");
								//w1.center();
								help.button("close");
								help.attachURL("grid_help.php");
								//help.attachObject("win_obj");	
								//help.show();
								help.attachEvent("onClose",function(){
										 --noOfHelpWinsOpen;
										 //help.hide();
										 close(); 
										 return true;
									});									
							} // for
								
							 						
								 
							break;	
							
						case 'reload':
							// deleteContacts(id);
							// alert('reloadgrid');
							reloadgrid();
							break;			
																						
						default: break;
							
					} // switch
 
			} // func



			function deleteContacts(checked){
				  var url;
				  var rowId = checked.split(",");
				   //alert(rowId);
				   
				   var delUrl = "griddelete.php?pros_id=";

				   if(rowId!=null){
						for (i=0; i<rowId.length; i++)
						{
							if ( rowId[i] != 0 )
							{
								// alert(rowId[i]);
								url = delUrl + rowId[i];
								dhtmlxAjax.get(url+"&&rs="+(new Date()).valueOf(), afterAction);

								CurrentTab=tabbar.getActiveTab();
				 
								if(CurrentTab=="a1"){
									contactsGrid.deleteRow(rowId[i]);
								}else if(CurrentTab=="a2"){
									contactsGridZ.deleteRow(rowId[i]);
								}else if(CurrentTab=="a3"){
									contactsGridA.deleteRow(rowId[i]);								
								}else if(CurrentTab=="a4"){
									contactsGridB.deleteRow(rowId[i]);											
								}else{
								alert("No Tab Selected");
									return false;
								}								
							}				
						}
					}				
			}
			
			
			function afterAction(loader)
			{
				return;
			}


			function reloadgrid(){
			
			//	contactsGrid.clearAll()

				CurrentTab=tabbar.getActiveTab();
 
 				if(CurrentTab=="a1"){
					contactsGrid.clearAll();
					contactsGrid.load("includes/mycontactsdb_leadform.php");	 		
				}else if(CurrentTab=="a2"){
					contactsGridZ.clearAll();				
					contactsGridZ.load("includes/mycontactsdb_8min.php");	 			
				}else if(CurrentTab=="a3"){
					contactsGridA.clearAll();				
					contactsGridA.load("includes/mycontactsdb_bizview.php");	 			
				}else if(CurrentTab=="a4"){
					contactsGridB.clearAll();				
					contactsGridB.load("includes/mycontactsdb_home.php");	 						
				}else{
				alert("No Tab Selected");
					return false;
				}
				
				
			
			function addNewTab(tab){
			    
				alert('tab');
			
			
			}				
				
				
				
				
			}
			
/*			  var p= toolbar.attachEvent("onClick", function(id){   
				   //var m=contactsGrid.getSelectedRowId(); 
     			   //alert("Button "+id+" was clicked and "+m+" was checked");   
				    				   
				   return id;
    			});*/

		 

	 	
		//	var dpg = new dataProcessor("codebase/dhtmlx_std_full/xml/contact_details.php");
		//	dpg.init(contactsGrid);			
						
			 	
			
		})	
	</script>

Here is the products or create folder window that pops up:

This window is activated upon the activation of
case:
“createNewTab” from the previous parent code set.

Please see the HTML COMMENT in CAPS.


<html>
<head>
</head>
	<body> 
	<div align="center">
 
			<h3 align="center">Create a New Folder</h3>
		 
			<? if($msg){ echo $msg; } ?>
			
			<div class="codeberg2">
				<form name="cf" id="cf" action="grid_createfolder.php" method="post">

					<label>Folder Name:</label>
					<input type="text" name="cfname" id="cfname"  value="<?=$_POST[cfname];?>" />
					<div class="clearfixboth"></div>

					<input type="submit" name="cfsubmit" id="cfsubmit" class="nostyle submit" value="Submit" />
				</form>
			</div>	
			
		<h4>The following Folders have been created by you:</h4>
<!-- THIS IS WHERE THE $F_NAME NEEDS TO DO SOME ACTION. IT NEEDS TO CLOSE THIS WINDOW, THEN PASS THE F_NAME[$i] TO THE PARENT AND THEN THE PARENT WILL OPEN A NEWTAB in the TABBAR. BASED ON THE F_NAME[$I] IT WILL PASS QUERY AND INSERT GRID VALUE. -->

<!-- BASICALLY I AM TRYING TO MIMIC A FEATURE LIKE THE GRIDTREE WHERE I CAN CREATE FOLDER AND CLICKING ON ANY FOLDER PROVIDES RELEVANT DATA IN GRID -->

		<div align="center" style="width: 80%;">
			<? // PRODUCTS or FOLDERS
				for($i=0;$i<$fcount;$i++){
					echo "<div class=\"whitebox floatleft\">".$f_name[$i]."</div>";
				}			
			?>
			<div class="clearfixboth"></div>
		</div>
	
<!-- THIS PART IS TESTING THE CLOSE AND IT IS NOT WORKING -->  
			<a href="javascript:void(0)" onclick="parent.win.close();">[Product1]</a>

	</div>
	
 
	
	</body>
</html>

Here is one sql connectivity file:

<?
include "../session.php";

// MySQL connection.
include "dbconn.php";

//echo 8 min movie
// 
 
$sql="SELECT * FROM `prospects`,`reference` WHERE 
prospects.pros_id=reference.ref_refd_id  AND 
reference.`ref_by_id`='$_SESSION[user_id]' AND 
reference.`ref_vid2_seen`='YES' AND 
reference.`ref_vid3_seen`='NO' AND 
prospects.`pros_firstname`!='NULL' AND 
prospects.`pros_email`!='NULL' 
ORDER BY `pros_id` DESC";
 
 
	$id="pros_id";

    require("../codebase/dhtmlxConnector/codebase/grid_connector.php");
 
	
    $grid = new GridConnector($con,"MySQL");
 
	function refid($data){	
		  $data->set_value("ref_by_id","");
	}
	
	function status(){
		$link="<a href='viewProduct.php?id=".$data->get_value("ProductId")."'>".$data->get_value("ProductName")."</a>";
		$data->set_value("ProductName",$link);
		}

//	$grid->event->attach("beforeRender","status");		
	$grid->event->attach("beforeRender","refid");	
    $grid->enable_log("temp.log",true);
    $grid->dynamic_loading(2000);

 $grid->render_sql($sql,$id, "ref_by_id,pros_id,pros_firstname,pros_lastname,pros_email,pros_phone,pros_notes");
// $grid->render_table("prospects","ref_by_id","pros_firstname","pros_email");
//$grid->render_table("prospects","ref_by_id","pros_firstname","pros_email");
	
	
//	if($grid->is_select_mode())
 
	
	
if($_SESSION[user_id]==""){		
	$gridConn->access->deny("read"); //blocks Select action
	$gridConn->access->deny("add"); //blocks Insert action
	$gridConn->access->deny("edit"); //blocks Update action
	$gridConn->access->deny("delete"); //blocks Delete action
}	
 
?>

Thanks!

[Product1]

win should be a public variable. It seems that it is private in your code:

dhtmlxEvent(window,“load”,function(){

var dhxWins,w1,help;

If the problem is not solved, we need the complete demo. It should not contain server-side scripts.