關於EasyUI的Layout總結

轉自http://blog.csdn.net/foart/article/details/9130937


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 plaincopyprint?
  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 plaincopyprint?
  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.                 });  


 


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章