Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Luke on Apr 30, 2009 04:34
open dhtmlx forum
AttachGrid inside Tabbar

I am trying to attach a grid inside a tabbar - is it possible?
I have tried the following codes learned from your previous answers

<div id="a_tabbar" style="width:500;height:500"></div>
<script>
tabbar=new dhtmlXTabBar("a_tabbar","top");
tabbar.setImagePath("../dhtmlxTabbar/codebase/imgs/");
tabbar.addTab("a1","Tab 1","100px");
tabbar.addTab("a2","Tab 2","100px");
tabbar.addTab("a3","Tab 3","100px");
var mygrid = tabbar.cells("a2").attachGrid();
mygrid.setImagePath("../dhtmlxTabbar/codebase/imgs/");
    mygrid.setHeader("Column A, Column B");
    mygrid.setInitWidths("100,250");
    mygrid.setColAlign("right,left");
    mygrid.setColTypes("ro,ed");
    mygrid.setColSorting("int,str");
    mygrid.enableMultiselect(true);
    mygrid.setSkin("modern");
    mygrid.init();
    mygrid.loadXML("grid.xml");
</script>

But it doesn't work. Please help.
Answer posted by Alex (support) on Apr 30, 2009 05:33

Hello,

attachGrid() method requires a little different approach:

1) First of all dhtmlxtabbar_wins.js and dhtmlxwindows libraries  must be included.

2) And after windows initialization:

var dhxWins = new dhtmlXWindows();

you can apply the following:

var mygrid = tabbar._cells(dhxWins,"a2").attachGrid();

Here "a2" is tab id where grid must be initialized