LigerUI入门帮助(API里没写的入门帮助)【不断更新】

LigerUI入门帮助(API里没写的入门帮助)【不断更新】

[布局]

为了让左边区域(#accordion1)的连接能显示到右边区域(#framecenter)并生成tab选项卡,需创建以下js函数:    [javascript]

  1. function f_heightChanged(options)
  2. {
  3. if (tab)
  4. tab.addHeight(options.diff);
  5. if (accordion && options.middleHeight - 24 > 0)
  6. accordion.setHeight(options.middleHeight - 24);
  7. }
  8. function f_addTab(tabid,text, url)
  9. {
  10. tab.addTabItem({ tabid : tabid,text: text, url: url });
  11. }
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]

  1. tab = $("#framecenter").ligerGetTabManager();
  2. accordion = $("#accordion1").ligerGetAccordionManager();
  3. tree = $("#tree1").ligerGetTreeManager();
tab = $("#framecenter").ligerGetTabManager();
accordion = $("#accordion1").ligerGetAccordionManager();
tree = $("#tree1").ligerGetTreeManager();


并将#tree1的声明修改为:    [javascript]

  1. $("#tree1").ligerTree({
  2. data :  .....
  3. checkbox: false,
  4. slide: false,
  5. nodeWidth: 120,
  6. attribute: ['nodename', 'url'],
  7. onSelect: function (node)
  8. {
  9. if (!node.data.url) return;
  10. var tabid = $(node.target).attr("tabid");
  11. if (!tabid)
  12. {
  13. tabid = new Date().getTime();
  14. $(node.target).attr("tabid", tabid)
  15. }
  16. f_addTab(tabid, node.data.text, node.data.url);
  17. }
  18. });