2013-08-05 62 views
0

嗨,我使用的是Dhtmlx網格..我需要dhtmlx tabbar ..參考他們的網站(http://www.dhtmlx.com/docs/products/dhtmlxTabbar/samples/05_components/01_grid_inside.html),i瞭解初始化網格..我做到了這一點..但標籤部分沒有stil work..let我知道我的hve糾正code..here是我的代碼在DHTMLX網格中集成網格與標籤

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" 
    pageEncoding="ISO-8859-1"%> 
<!DOCTYPE> 
<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> 
<title>Insert title here</title> 


<!-- dhtmlxGrid --> 

<link rel="stylesheet" type="text/css" href="../dhtmlxGrid/codebase/dhtmlxgrid.css"> 
<link rel="stylesheet" type="text/css" href="../dhtmlxGrid/codebase/skins/dhtmlxgrid_dhx_skyblue.css"> 
<link rel="STYLESHEET" type="text/css" href="../codebase/css/dhtmlxtabbar.css"> 
<script src="../codebase/dhtmlxcommon.js"></script> 
<script src="../codebase/dhtmlxgrid.js"></script> 
<script src="../codebase/ext/dhtmlxgrid_srnd.js"></script> 
<script src="../codebase/dhtmlxgridcell.js"></script> 
<script src="../codebase/dhtmlxcontainer.js"></script> 
<script src="../codebase/dhtmlxtabbar.js"></script> 


<script type="text/javascript"> 

</script> 
</head> 
<body> 


<div id="gridbox" style="width:600px;height:200px"> 
<div id="a_tabbar" style="width:395px; height:390px;"></div> 
</div> 
<script>//Loading data from XML: 

mygrid = new dhtmlXGridObject('gridbox'); 
    mygrid.setImagePath("../codebase/imgs/"); 
    mygrid.setHeader("Name,Index,Code"); 
    mygrid.setInitWidths("150,150,*"); 
    mygrid.setColAlign("left,left"); 
    mygrid.setColSorting("str,str,str"); 
    mygrid.setColTypes("txt,txt,txt"); 
    mygrid.setSkin("dhx_skyblue"); 
    mygrid.loadXML("../grid.xml");//load data */ 
    mygrid.init(); 
    tabbar = new dhtmlXTabBar("a_tabbar", "top"); 
    tabbar.setSkin('dhx_skyblue'); 
    tabbar.setImagePath("codebase/imgs/"); 
    tabbar.addTab("a1", "Tab 1-1", "100px"); 
    tabbar.addTab("a2", "Tab 1-2", "100px"); 
    tabbar.setTabActive("a1"); 
    mygrid = tabbar.cells("a1").attachGrid(); 
    mygrid.setImagePath("../../../dhtmlxGrid/codebase/imgs/"); 
    mygrid.attachEvent("onRowSelect", function(rowId,cIndex){alert(rowId)}); 
    </script> 
</body> 
</html> 

回答

0

做了下道:

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

mygrid = tabbar.cells("a1").attachGrid(); 
mygrid.setImagePath("../codebase/imgs/"); 
mygrid.setHeader("Name,Index,Code"); 
mygrid.setInitWidths("150,150,*"); 
mygrid.setColAlign("left,left"); 
mygrid.setColSorting("str,str,str"); 
mygrid.setColTypes("txt,txt,txt"); 
mygrid.setSkin("dhx_skyblue"); 
mygrid.attachEvent("onRowSelect", function(rowId,cIndex){alert(rowId)}); 
mygrid.loadXML("../grid.xml");//load data */ 
mygrid.init();