Attch New Grid on Tab on Add Tab

Hi,

AM working on a CHAT dhtmlx program.

When someone clicks on on of the Users, it Creates a new Tab and attaches the Grid Tab, if not already created, if the Tab exists, it just sets the Tab as active.

AM able to vreate the TABS dynamicall, the TAB id is the username of the slecetd user, THE problem is creating the Dynamic Grids, do grids have ID’s?

Please Help.

Ndegwer | Kenya

Hi
Try the next approach:

[code]

tabbar







<style>
    html, body {
       width: 100%;
       height: 100%;
       margin: 0px;
       overflow: hidden;
       background-color:white;
    }
</style>	

	<script>
	dhtmlxEvent(window,"load",function(){
        tabbar = new dhtmlXTabBar("userTab", "top");
        tabbar.setSkin('dhx_skyblue');
        tabbar.setImagePath("../dhtmlxTabbar/codebase/imgs/");
        tabbar.setSkinColors("white","#FFFACD");
        tabbar.setStyle("dhx_skyblue");
        tabbar.addTab("a1", "Tab 1-1", "100px");
        tabbar.addTab("a2", "Tab 1-2", "100px");
        tabbar.addTab("a3", "Tab 1-3", "100px");

        grids = {};
        tabbar.attachEvent("onSelect", function(id){
            if (!grids[id]){
                var grid = tabbar.cells(id).attachGrid();
                grid.loadXML("../___xml/grid.xml");
                grids[id] = grid;
            }
            return true;
        });
	})
	</script>
</head>

<body>
	<div align="center" valign="middle">
		<div id="userTab" class="dhtmlxTabBar" style="width:70%; height:80%" offset="100px" align="center" valign="middle">
		</div>
	</div>
</body>
[/code] I've place just one grid, but you need to use different according to logic of your application