- 浏览: 38242 次
- 性别:
- 来自: 上海
-
最新评论
1. Tabbar initialization
a. Initialize TabBar Object from Javascript Constructor
<script src="../codebase/dhtmlxcommon.js"></script>
<script src="../codebase/dhtmlxtabbar.js"></script>
<div id="a_tabbar" style="width:400;height:100"></div>
<script>
tabbar=new dhtmlXTabBar("a_tabbar");
tabbar.setImagePath("../codebase/imgs/");
</script>
b. Initialize tabbar object from html structure
<script src="../codebase/dhtmlxcommon.js"></script>
<script src="../codebase/dhtmlxtabbar.js"></script>
<script src="../codebase/dhtmlxtabbar_start.js"></script>
<div id="a_tabbar" class="dhtmlxTabBar" imgpath="../codebase/imgs/" style="width:390; height:390;" skinColors="#FCFBFC,#F 4F3EE" >
<div id="a1" name="Tab 1">Content 1</div>
<div id="a2" name="Tab 2">Content 2</div>
<div id="a3" name="Tab 3">Content 3</div>
</div>
c. Building tabbar with javascript
<div id="a_tabbar" style="width:400;height:100"></div>
<script>
tabbar=new dhtmlXTabBar("a_tabbar","top");
tabbar.setImagePath("../codebase/imgs/");
tabbar.addTab("a1","Tab 1-1","100px");
tabbar.addTab("a2","Tab 1-2","100px");
tabbar.addTab("a3","Tab 1-3","100px");
</script>
d. Building tabbar from xml
<div id="a_tabbar" style="width:400;height:100"></div>
<script>
tabbar=new dhtmlXTabBar("a_tabbar","top");
tabbar.setImagePath("../codebase/imgs/");
tabbar.loadXML("tabs.xml");
</script>
Tabs.xml:
<?xml version="1.0"?>
<tabbar>
<row>
<tab id="a1" width='200px'>Tab 1-1</tab>
<tab id="a2" width='200px'>Tab 1-2</tab>
</row>
<row>
<tab id="b1" width='150px'>Tab 2-1</tab>
<tab id="b2" width='100px' selected="1">Tab 2-2</tab>
<tab id="b3" width='150px'>Tab 2-3</tab>
</row>
</tabbar>
2. Content loading
a. Assigning content to tabs with javascript
<div id="a_tabbar" style="width:400;height:100"></div>
<div id="html_1" >Some content</div>
<script>
tabbar=new dhtmlXTabBar("a_tabbar","top");
tabbar.setImagePath("../codebase/imgs/");
tabbar.addTab("a1","Tab 1-1","100px");
tabbar.addTab("a2","Tab 1-2","100px");
tabbar.setContent("a1","html_1");
tabbar.setContentHTML("a2","<br/>The content can be set as...
</script>
b. assigning content to tabs in xml
<?xml version="1.0"?>
<tabbar>
<row>
<tab id="a1" width='200px'>Tab 1-1
<content>
<![CDATA[{{dhtmlxTabbar:imgs/page_a.gif'}}]]>
</content>
</tab>
<tab id="a2" width='200px'>Tab 1-2
<content>
<![CDATA[
<table>
<tr><td>Some data</td></tr>
</table>
]]>
</content>
</tab>
</row>
</tabbar>
c. loading content in iframes
<?xml version="1.0"?>
<tabbar hrefmode="iframe">
<row>
<tab id="b1" width='100px' href="http://groups.google.com">Google groups</tab>
<tab id="b2" width='100px' selected="1" href="http://google.com">Google search</tab>
</row>
</tabbar>
d. loading content with ajax
<?xml version="1.0"?>
<tabbar hrefmode="ajax">
<row>
<tab id="b1" width='100px' selected="1" href="slow_ajax.php?num=1">SCBR 1</tab>
<tab id="b2" width='100px' href="slow_ajax.php?num=2">SCBR 2</tab>
<tab id="b3" width='100px' href="slow_ajax.php?num=3">SCBR 3</tab>
</row>
</tabbar>
e. mixed loading mode
<script>
tabbar=new dhtmlXTabBar("a_tabbar","top");
tabbar.setImagePath("../codebase/imgs/");
tabbar.setHrefMode("ajax-html");
tabbar.setSkinColors("#FCFBFC","#F4F3EE");
tabbar.addTab("a1","Static","100px");
tabbar.addTab("a2","AJAX","100px");
tabbar.setContentHTML("a1","Some static text here");
tabbar.setContentHref("a2","http://some.url/here");
tabbar.setTabActive("a1");
</script>
3. Working with dhtmlxTabBar
a. setting: position, align, offset, marging
<div id="a_tabbar" style="width:400;height:100"></div>
<script>
tabbar=new dhtmlXTabBar("a_tabbar","top"); //top,bottom,left,right
tabbar.setImagePath("../codebase/imgs/");
tabbar.setAlign("left"); //left,rigth,top,bottom
tabbar.setMargin("2");
tabbar.setOffset("5");
tabbar.loadXML("tabs.xml");
</script>
b. skining: colors, predefined skins
<div id="a_tabbar" style="width:400;height:100"></div>
<script>
tabbar=new dhtmlXTabBar("b_tabbar","top");
tabbar.setImagePath("../codebase/imgs/");
tabbar.setStyle("winScarf");
tabbar.setSkinColors("#FFFF00","#FFFACD");
</script>
Note: tabbar colors: the first argument sets background for active tab, second - for other tabs
Also you can define custom color for each tab separately by using setCustomStyle command.
tabbar.setCustomStyle('a4',"#F5F5DC","#F0F8FF");
c. Normallization
//just rebuild tabbar, rows will be created automatically to prevent scrolling
tabbar.normalize();
//same as previous, but the width of row will be limited to 600px
tabbar.normalize(600);
//same as previous, tab caption size on last row will be changed to fill all row
tabbar.normalize(600,true);
d. manage tabbar and tab content area size
set tabs content area size depending on content size:
//param 1 - adjust width automatically
//param 2 - adjust height automatically
tabbar.enableAutoSize(true,true);
set tabs content size depending on tabbar’s container size:
tabbar.enableAutoReSize(true);
set fixed (minimal in case of autosize) size of tabbar:
//param 1 - width
//param 2 - height
//param 3 - true means that given size is size of content area only
tabbar.setSize("200px","300px",true)
e. Manage each tab with script api
get/set (change) label of tab:
<script>
//param - tab ID
tabbar.getLabel(tabId);
//param 1 - tab ID
//param 2 - label string
tabbar.setLabel(tabId,"New tab Label");
</script>
show/hide existing tab:
<script>
//param 1 - tab ID
//param 2 - if true, then selection from hidden tab should be moved to nearest one
tabbar.hideTab(tab,true);
//param 1 - tab ID
tabbar.showTab(tabId);
</script>
add/remove tab:
<script>
//param 1 - tab ID
//param 2 - new tab label
//param 3 - size in px
//param 4 - index in row (optional)
//parma 5 - index of row (optional)
tabbar.addTab(tabId,"Label",100,0,0);
//param 1 - tab ID
//param 2 - if true, then selection from deleted tab should be moved to nearest one
tabbar.removeTab(tabId,true);
</script>
disable/enable tab:
<script>
//param 1 - tab ID
//param 2 - if true, then selection from disabled tab should be moved to nearest one
tabbar.disableTab(tabId,true);
//param 1 - tab ID
tabbar.enableTab(tabId);
</script>
set/get active tab:
<script>
tabbar.getActiveTab();
//param 1 - tab ID
tabbar.setTabActive(tabId);
</script>
4. Special modes in tabbar
Closing button for each tab
tabbar.enableTabCloseButton(true)
Extended hide mode
tabbar.enableForceHiding(true)
5. Events Handling
onTabClose - occurs when tab closed by close button
tabbar.attachEvent("onTabClose", function(id){
//any custom code
return true;
});
Note: id – id of tab which is closing.
onSelect – occurs when tab selected.
tabbar.attachEvent("onSelect", function(id,last_id){
//any custom code
return true;
});
Note: id – id of selected tab
Last_id – id of previously selected tab
onXLS – occurs when xml loading started
tabbar.attachEvent("onXLS", function(){
//any custom code
});
OnXLE – occurs when xml loading finished
tabbar.attachEvent("onXLE", function(){
//any custom code
});
onTabContentLoaded – occurs when content of tab loaded (for ajax – html mode only)
tabbar.attachEvent("onTabContentLoaded", function(id){
//any custom code
return true;
});
Attaching event handler
tabbar.attachEvent(evName, evHandler);
note: evName – name of the event;
evHandler – user-defined event handler.
Removing event handler
var id = tabbar.attachEvent(evName, evHandler);
//...
tabbar.detachEvent(id); // unique id of the event handler
6. Attaching DHTMLX Components
Attaching components to tabbar’s cells
dhtmlxTree;
dhtmlxGrid;
dhtmlxTreeGrid;
dhtmlxTabbar;
dhtmlxAccordion;
dhtmlxFolders;
dhtmlxMenu;
dhtmlxToolbar;
dhtmlxEditor;
dhtmlxLayout;
Status Bar.
Attaching Tree
<script>
tabbar.addTab("tab1","First tab","100px");
var dhxTree = tabbar.cells("tab1").attachTree();
</script>
Attaching other dhtmlx components
<script>
var dhxGrid = tabbar.cells("tab1").attachGrid();
var dhxTreeGrid = tabbar.cells("tab1").attachGrid();
var dhxTabbar = tabbar.cells("tab1").attachTabbar();
var dhxAccord = tabbar.cells("tab1").attachAccordion();
var dhxFolders = tabbar.cells("tab1").attachFolders();
var dhxMenu = tabbar.cells("tab1").attachMenu();
var dhxBar = tabbar.cells("tab1").attachToolbar();
var dhxEditor = tabbar.cells("tab1").attachEditor();
var db = tabbar.cells("tab1").attachStatusBar();
</script>
Note: if you want to attach dhtmlxGrid with paging to the dhtmlxTabbar tab you should use setContent() method to attach container with grid and paging area:
tabbar.setContent("a1","paging_container");
相关推荐
### dhtmlxTabbar如何访问每个选项的DOM 在探讨如何获取dhtmlxTabbar中每个选项的DOM之前,我们先来了解一下dhtmlxTabbar的基本概念及其在Web开发中的应用。 #### dhtmlxTabbar简介 dhtmlxTabbar是dhtmlxSuite组件...
**dhtmlxTabbar标签式框架详解** dhtmlxTabbar是一款强大的JavaScript组件,用于在Web应用程序中实现标签式布局。这个框架允许开发者创建可扩展、功能丰富的用户界面,通过在多个标签页之间切换,展示不同的内容...
**dhtmlxTabbar选项卡控件详解** dhtmlxTabbar是一款优秀的JavaScript库,它提供了丰富的选项卡界面设计功能,适用于网页应用中构建多页面布局。这款控件以其强大的功能和灵活的设计,使得开发者只需编写少量的...
**dhtmlxTabbar v.2.0 专业版**是一款强大的JavaScript库,用于在Web应用程序中实现功能丰富的标签页式界面。这个专业版包含了版本号81009和81107的构建,提供了更高级的功能和优化,以满足开发者的高级需求。 **1....
### dhtmlxTabBar中文帮助文档知识点解析 #### 一、概述 `dhtmlxTabBar` 是一款灵活且功能强大的 JavaScript 库组件,用于在网页应用中创建可交互的标签栏界面。此组件允许开发者轻松地组织内容,并提供用户友好的...
“dhtmlx官方框架——dhtmlxGrid和dhtmlxTabbar示例、简单例子” 这个标题提到了两个关键组件,dhtmlxGrid和dhtmlxTabbar,它们是dhtmlx框架中的核心部分。dhtmlx是一个广泛使用的JavaScript库,用于构建富客户端Web...
**dhtmlXTabBar** 是一个强大的JavaScript组件,主要用于在Web应用中实现多标签页功能。这个组件由dhtmlxSuite库提供,它允许开发者轻松地在网页上创建交互式的、可自定义的标签栏,以提升用户体验和界面组织。 **...
**dhtmlxTabbar**是一款强大的JavaScript库,用于在Web应用程序中创建美观、功能丰富的标签页界面。这个库提供了一种高效的方式,使得用户可以在单个页面上组织多个视图或工作区,从而提高用户体验和界面的易用性。...
3. `dhtmlxtabbar.js`, `dhtmlxcommon.js`:这两个JavaScript文件是Tab组件的核心,`dhtmlxtabbar.js`可能包含了Tab组件的主要功能和事件处理,而`dhtmlxcommon.js`可能是通用的辅助函数库,用于跨组件的共享功能。...
根据提供的文件信息,我们可以从《DHTMLX中文使用手册》这一资源中提炼出与DHTMLX相关的多个知识点。下面将详细介绍这些知识点。 ### DHTMLX简介 DHTMLX 是一个全面且功能强大的JavaScript库,旨在帮助开发者快速...
接下来,我们看到dhtmlxCombo、dhtmlxDataProcessor、dhtmlxTabbar等文件,它们代表了dhtmlx库的核心组件: 1. dhtmlxCombo:这是一个先进的下拉选择框组件,支持多选、自定义过滤和搜索,能够灵活地处理各种数据源...
dhtmlxTabbar支持动态添加和删除标签页,允许设置自定义样式和事件,以适应不同场景的需求。 5. **dhtmlxWindows**:dhtmlxWindows是一个窗口管理组件,用于创建浮动的、可拖动和可调整大小的窗口。这些窗口可以...
- 范围:覆盖了dhtmlxCalendar、dhtmlxCombo、dhtmlxEditor、dhtmlxLayout、dhtmlxMenu、dhtmlxTabBar、dhtmlxToolbar、dhtmlxTree以及dhtmlxGrid等组件,以及hyProgressBar进度条控件。 - 名词定义:手册中可能...
DHTMLX是一套完整的JavaScript组件集,包括dhtmlxSuite,它由多个子组件构成,如dhtmlxMenu、dhtmlxCombo、dhtmlxDataProcessor和dhtmlxTabbar等。这些组件涵盖了网页开发中的各种常见功能,如下拉菜单、组合框、...
4. dhtmlxTabbar:dhtmlxTabbar是一款JavaScript库,用于在Web应用中实现多标签页面。它提供丰富的样式定制选项,支持动态添加和删除标签页,可以极大地提升用户体验。 5. dhtmlxGrid:dhtmlxGrid是一款强大的...
这个**dhtmlxSuite.zip** 文件包含了多个关键组件,如**dhtmlxMenu**、**dhtmlxCombo**、**dhtmlxVault**、**dhtmlxDataProcessor**、**dhtmlxTabbar**、**dhtmlxConnector** 和 **dhtmlxSlider**,以及相关的文档和...
dhtmlxTabbar 提供了一个多标签的界面,允许用户在不同的视图之间轻松切换。它支持多种布局和定制选项,如滚动、图标和分页,使得应用程序的导航更加直观和方便。 8. **dhtmlxLayout** dhtmlxLayout 是一个布局...
4. **dhtmlxTabbar**:该组件允许在Web应用中创建多标签布局,每个标签页可以包含任意HTML内容,有助于组织和导航复杂的应用界面。 5. **dhtmlxSlider**:滑块控件用于设置数值或选择范围,常用于调整音量、亮度等...