LigerUI入门帮助(API里没写的入门帮助)【不断更新】
[布局]
为了让左边区域(#accordion1)的连接能显示到右边区域(#framecenter)并生成tab选项卡,需创建以下js函数: [javascript]
- function f_heightChanged(options)
- {
- if (tab)
- tab.addHeight(options.diff);
- if (accordion && options.middleHeight - 24 > 0)
- accordion.setHeight(options.middleHeight - 24);
- }
- function f_addTab(tabid,text, url)
- {
- tab.addTabItem({ tabid : tabid,text: text, url: url });
- }
function f_heightChanged(options)
{
if (tab)
tab.addHeight(options.diff);
if (accordion && options.middleHeight - 24 > 0)
accordion.setHeight(options.middleHeight - 24);
}
function f_addTab(tabid,text, url)
{
tab.addTabItem({ tabid : tabid,text: text, url: url });
}
然后在 $(function (){ ...........});里加入: [javascript]
- tab = $("#framecenter").ligerGetTabManager();
- accordion = $("#accordion1").ligerGetAccordionManager();
- tree = $("#tree1").ligerGetTreeManager();
tab = $("#framecenter").ligerGetTabManager();
accordion = $("#accordion1").ligerGetAccordionManager();
tree = $("#tree1").ligerGetTreeManager();
并将#tree1的声明修改为: [javascript]
- $("#tree1").ligerTree({
- data : .....
- checkbox: false,
- slide: false,
- nodeWidth: 120,
- attribute: ['nodename', 'url'],
- onSelect: function (node)
- {
- if (!node.data.url) return;
- var tabid = $(node.target).attr("tabid");
- if (!tabid)
- {
- tabid = new Date().getTime();
- $(node.target).attr("tabid", tabid)
- }
- f_addTab(tabid, node.data.text, node.data.url);
- }
- });