關於EasyUI的Layout總結


1、layout以html標簽方式建立的

  1. <div id="content" region="center" border="false" class="easyui-layout">  
  2.                       
  3.                     <div id="divPage1"  
  4.                         data-options="region:'west'"  
  5.                         style="width: 150px;"></div>  
  6.                     <div id="divPage2"  
  7.                         data-options="region:'center',href:'${basePath}/userManage_main.jspx'"></div>  
  8.                       
  9.                 </div>  


這樣,如果我想重新修改 div id="divPage1"這個layout的href屬性,應該怎么實行?

實現方法:

[javascript] view plain copy print?
  1. $("#divPage1").panel({region:'west',href:'${basePath}/userManage_left.jspx?width='+width});  
  2. $("#divPage1").panel('refresh');  


必須執行panel的‘refresh’方法才會生效,因此這個‘userManage_left.jspx’頁面會被執行2次。目前我的解決辦法是使用js腳本建立的方式來解決。

 

2、用js腳本方式建立的

先建立一個div標簽,用於生成layout。

 

  1. <div id="content" />  

 

js腳本創建

 

[javascript] view plain copy print?
    1. $('#content').layout('add',{     
    2.                     region: 'west',     
    3.                     width: 180,     
    4.                     title: 'West Title',     
    5.                     split: true,     
    6.                     href:'${basePath}/userManage_left.jspx?width='+width,  
    7.                     tools: [{     
    8.                         iconCls:'icon-add',     
    9.                         handler:function(){alert('add')}     
    10.                     },{     
    11.                         iconCls:'icon-remove',     
    12.                         handler:function(){alert('remove')}     
    13.                     }]     
    14.                 });  
    15.                 $('#content').layout('add',{     
    16.                     region: 'center',     
    17.                     width: 580,     
    18.                     title: 'center Title',     
    19.                     split: true,     
    20.                     href:'${basePath}/userManage_main.jspx',  
    21.                     tools: [{     
    22.                         iconCls:'icon-add',     
    23.                         handler:function(){alert('add')}     
    24.                     },{     
    25.                         iconCls:'icon-remove',     
    26.                         handler:function(){alert('remove')}     
    27.                     }]     
    28.                 }); 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM