關於EasyUI的Layout總結

一、layout以html標籤方式創建的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屬性,應該怎麼實行?java

實現方法:jsp

[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腳本創建的方式來解決。ui

 

二、用js腳本方式創建的spa

先創建一個div標籤,用於生成layout。.net

 

  1. <div id="content" />  

 

js腳本建立xml

 

[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.                 }); 
相關文章
相關標籤/搜索