Cant load grid into tabbars

I’m sure Im missing something simple but I have been playing with this all day and I cant get it right. I’ve read all the threads and looked at the sample for grid and tabbar but I just cant get this going. My grid was working perfectly until I tried to add the tabbar. All I want is two tabs that each load grids. I’m trying to get the first grid loaded and nothing will come up, all I see on my page now is two tabs that read Pending and Approved, no grid. My code is as follows:

tabbar = new dhtmlXTabBar("a_tabbar", "top"); tabbar.setSkin('dhx_skyblue'); tabbar.setImagePath("codebase/imgs/"); tabbar.addTab("a1", "Pending", "100px"); tabbar.addTab("a2", "Approved", "100px"); tabbar.setTabActive("a1"); var mygrid = tabbar.cells("a1").attachGrid();
		function doInitGrid(){
			
		mygrid = new dhtmlXGridObject('mygrid_container');
		mygrid.setImagePath("codebase/imgs/");
		mygrid.setHeader("Manufacturer,Item Number,Description,List Price,Sugg. Price,Requesting Clinician,Clinician Email,GPO Contract Item, Contract Number");
		mygrid.attachHeader("#text_filter,#text_filter,#text_filter, , ,#text_filter,#text_filter, , ");
		mygrid.setInitWidths("95,80,250,60,60,105,115,90,75");
		mygrid.enableAutoWidth(false);
		mygrid.setColTypes("ro,ro,ro,price,price,ro,ro,ro,ro,ro");
		mygrid.setColSorting("str,int,str,int,int,str,str,int,int");
		mygrid.setColAlign("center,center,left,center,center,center,center,center,center");
		mygrid.setSkin("light");			
		mygrid.init();
		mygrid.load("connector.php")
		
		
		}
</script>

Can someone please tell me what I’m missing? Thank you so much.

mygrid = new dhtmlXGridObject(‘mygrid_container’);

This code snippet initializes grid in a certain html container. attachGrid() is used instead of it.

The following will be correct:

tabbar = new dhtmlXTabBar("a_tabbar", "top"); tabbar.setSkin('dhx_skyblue'); tabbar.setImagePath("codebase/imgs/"); tabbar.addTab("a1", "Pending", "100px"); tabbar.addTab("a2", "Approved", "100px"); tabbar.setTabActive("a1");

var mygrid = tabbar.cells(“a1”).attachGrid();
mygrid.setImagePath(“codebase/imgs/”);

mygrid.init();
mygrid.load(“connector.php”);