<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    沉睡森林@漂在北京

    本處文章除注明“轉載”外均為原創,轉載請注明出處。

      BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
      152 隨筆 :: 4 文章 :: 114 評論 :: 0 Trackbacks
    最近一直在考慮將ext進行標簽處理,利用簡單的標簽和屬性輸出ext的ui效果。將常用的ext方法進行封裝,提供統一的js函數給外部調用,以此提高開發的效率。下面是一點嘗試的成果,需要改進的東西還很多很多。希望自己在5月份可以多多的整理文檔,和做ext開發的朋友分享。




    代碼還是有不少的問題,不過基本的框架出來了。
    下面是jsp代碼:
    <%@ page contentType="text/html;charset=UTF-8" %>
    <%@ taglib uri="/WEB-INF/greatwall.tld" prefix="gw" %>
    <%@ include file="/commons/taglibs.jsp" %>

    <gw:html>
    <gw:head>
    <base href="${ctx}/${basePath}">
    <gw:title caption="Extjsptag TextTags Demo"/>
    <%@ include file="/commons/button-icon.jsp"  %>
    </gw:head>
       

    <gw:body>
    <gw:script>
    function func_button_submitForm(){
        queryGrid('sysUserinfoList','sysUserinfo');
    }  

    function func_button_resetForm(){
        resetForm('sysUserinfo');
    }

    function func_button_addRecord(){
        var page = new pageDefine('insert-sys_userinfo.jsp',200,600);
        page.goPage();
    }

    function func_button_updateRecord(){
        var page = new pageDefine('txn090903.do',200,600);
        page.addGridValue('userId','sysUserinfoList:userId');
        page.goPage();
    }

    function func_button_deleteRecord(){
        var page = new pageDefine('txn090906.do');
        page.addGridValues('userId','sysUserinfoList:userId');
        page.deleteRecord('確認刪除選中的記錄?','sysUserinfoList');
    }  
    </gw:script>
         
    <gw:viewport>
            
    <gw:block title="查詢用戶管理"   name="sysUserinfo" columns="2"  height="150" region="north" >
                
    <gw:text name="username" fieldLabel="用戶名"   colspan="1"   />
                
    <gw:text name="email" fieldLabel="電子郵箱" colspan="1"    />
                
                
    <gw:submit name="button_submitForm" handler="func_button_submitForm" />
                
    <gw:reset name="button_resetForm" handler="func_button_resetForm" />
            
    </gw:block>

            
    <gw:grid name="sysUserinfoList" title="用戶管理列表" region="center" keyid="userinfoId" rownum="true" checkbox="true" url="txn090902.do"  >
                
    <gw:button text="增加用戶管理" name="button_addRecord"  handler="func_button_addRecord"   icon="icon_add.gif"  />
                
    <gw:button text="修改用戶管理" name="button_updateRecord" handler="func_button_updateRecord" enablerule="1" icon="icon_update.gif"  />
                
    <gw:button text="刪除用戶管理" name="button_deleteRecord" handler="func_button_deleteRecord" enablerule="2"   icon="icon_delete.gif"  /> 
                
                
    <gw:cell dataIndex="userinfoId" header="用戶表ID" width="100"/>
                
    <gw:cell dataIndex="username"  sortable="true"  header="用戶名" width="100" />
                
    <gw:cell dataIndex="email" header="電子郵箱" width="100"/>
            
    </gw:grid>
        
    </gw:viewport>  
    </gw:body>
    </gw:html>


    下面是現實后的html代碼:
    <html> 
     
    <head> 
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> 
    <meta http-equiv="Cache-Control" content="no-store"/> 
    <meta http-equiv="Pragma" content="no-cache"/> 
    <meta http-equiv="Expires" content="0"/> 
    <script src="http://localhost:8080/sie/script/ext/ext-base.js" type="text/javascript"></script> 
    <script src="http://localhost:8080/sie/script/ext/ext-all.js" type="text/javascript"></script> 
    <script src="http://localhost:8080/sie/script/ext/ext-lang-zh_CN.js" type="text/javascript"></script> 
    <link href="http://localhost:8080/sie/script/ext/resources/css/ext-all.css" type="text/css" rel="stylesheet"> 
    <script src="http://localhost:8080/sie/script/extjsptag-form.js" type="text/javascript"></script> 
    <script src="http://localhost:8080/sie/script/extjsptag-public.js" type="text/javascript"></script> 
    <script src="http://localhost:8080/sie/script/extjsptag-grid.js" type="text/javascript"></script> 
    <script src="http://localhost:8080/sie/script/extjsptag-page.js" type="text/javascript"></script> 
     
    <base href="/sie/module/yhqxgl/sys_userinfo/"> 
    <title>Extjsptag TextTags Demo</title> 
     
    <style> 
    .icon_add 
    {
      background
    : url('/sie/script/button-icon/icon_add.gif') 0 2 no-repeat   !important;
    }

    .icon_delete 
    {
      background
    : url('/sie/script/button-icon/icon_delete.gif') 0 2 no-repeat  !important;
     
    }

    .icon_update 
    {
      background
    : url('/sie/script/button-icon/icon_update.gif')  0  2 no-repeat  !important;
    }

    .icon-pub1 
    {
      background
    : url('/sie/script/button-icon/icon-pub1.gif')  0 0  no-repeat  !important;
    }
       
    </style> 
    </head> 
     
       
     
    <body> 
    <script> 
     
    var pWinCmpId = null;
     
    Ext.BLANK_IMAGE_URL 
    = 'http://localhost:8080/sie/script/ext/resources/images/default/s.gif';
    var basePath = 'http://localhost:8080/sie/module/yhqxgl/sys_userinfo/';
    var rootPath = 'http://localhost:8080/sie/';
     
    Ext.onReady(
    function() {
     
    Ext.QuickTips.init();
    Ext.form.Field.prototype.msgTarget 
    = 'qtip';
     
     
    /******************下面開始Body內JavaScript代碼輸出************************/
     
    /********************************************/
    /******開始輸出用戶自定義JavaScript部分******/
     
    function func_button_submitForm(){
        queryGrid('sysUserinfoList','sysUserinfo');
    }
      
     
    function func_button_resetForm(){
        resetForm('sysUserinfo');
    }

     
    function func_button_addRecord(){
        
    var page = new pageDefine('insert-sys_userinfo.jsp',200,600);
        page.goPage();
    }

     
    function func_button_updateRecord(){
        
    var page = new pageDefine('txn090903.do',200,600);
        page.addGridValue('userId','sysUserinfoList:userId');
        page.goPage();
    }

     
    function func_button_deleteRecord(){
        
    var page = new pageDefine('txn090906.do');
        page.addGridValues('userId','sysUserinfoList:userId');
        page.deleteRecord('確認刪除選中的記錄?','sysUserinfoList');
    }
      
    /******用戶自定義JavaScript部分結束********/
    /******************************************/
     
         
            
    var sysUserinfo_bodyWidth = document.body.clientWidth ; 
    var sysUserinfo_columns = 2 * 2;
    var sysUserinfo_perWidth = sysUserinfo_bodyWidth/sysUserinfo_columns;
     
     
    var sysUserinfo = new Ext.form.FormPanel({
      region:'north',
      buttonAlign:'center',frame:
    true,layout:'table',
      name:'sysUserinfo',id:'sysUserinfo',height:
    150,title:'查詢用戶管理',
      layoutConfig: 
    {columns:sysUserinfo_columns},
      defaults:
    {border:false,layout:'form',frame:false,labelAlign:'right',labelWidth:75,width:sysUserinfo_bodyWidth ,height:30}
    }
    );
     
                
    sysUserinfo.add(
    {
      name:'sysUserinfo_item_username',id:'sysUserinfo_item_username',
      colspan:
    2,bodyStyle:'padding:2px',
      width:sysUserinfo_perWidth
    *2-15  , 
      items:
    {
        xtype:'textfield',name:'username',anchor:'
    100%',fieldLabel:'用戶名',id:'username'
      }

    }
    );
     
                
    sysUserinfo.add(
    {
      name:'sysUserinfo_item_email',id:'sysUserinfo_item_email',
      colspan:
    2,bodyStyle:'padding:2px',
      width:sysUserinfo_perWidth
    *2-15  , 
      items:
    {
        xtype:'textfield',name:'email',anchor:'
    100%',fieldLabel:'電子郵箱',id:'email'
      }

    }
    );
     
                
                
    sysUserinfo.addButton(
    {xtype:'button',name:'button_submitForm',handler:func_button_submitForm,text:'確  定',type:'submit',id:'button_submitForm'});
     
                
    sysUserinfo.addButton(
    {xtype:'button',name:'button_resetForm',handler:func_button_resetForm,text:'重  置',type:'reset',id:'button_resetForm'});
     
            
     
     
     
    sysUserinfo.on(
    "bodyresize"function(){
      
    var _bodyWidth = document.body.clientWidth ; 
      
    var sysUserinfo_columns = 2 * 2;
      
    var _perWidth = _bodyWidth/sysUserinfo_columns;
      sysUserinfo.getComponent(
    "sysUserinfo_item_username").setWidth(_perWidth * 2-15);
      sysUserinfo.getComponent(
    "sysUserinfo_item_email").setWidth(_perWidth * 2-15);
    }
    );
     
     
            
                
                
                 
                
                
                
                
            
    var sysUserinfoList_grid_record = Ext.data.Record.create([
      
    {name:'userinfoId',type:'string'},
      
    {name:'username',type:'string'},
      
    {name:'email',type:'string'}
    ]);
     
    var sysUserinfoList_grid_store = new Ext.data.Store({
      proxy : 
    new Ext.data.HttpProxy({url : 'http://localhost:8080/sie/txn090902.do'}),
      reader : new Ext.data.JsonReader({root : 'result',totalProperty : 'totalCount',id : 'userinfoId'}, sysUserinfoList_grid_record)
    }
    );
     
    var sysUserinfoList_grid_sm = new Ext.grid.CheckboxSelectionModel({dataIndex : 'userinfoId'});
    var sysUserinfoList_grid_rownum = new Ext.grid.RowNumberer();
    var sysUserinfoList_grid_cm = new Ext.grid.ColumnModel([
      sysUserinfoList_grid_sm,
      sysUserinfoList_grid_rownum,
      
    {dataIndex:'userinfoId',width:100,type:'string',header:'用戶表ID'},
      
    {dataIndex:'username',sortable:true,width:100,type:'string',header:'用戶名'},
      
    {dataIndex:'email',width:100,type:'string',header:'電子郵箱'}
    ]);
     
    var displayMsg = '顯示第【<b><font color=red>{0}</font></b>】條至第【<b><font color=red>{1}</font></b>】條 / 共【<b><font color=red>{2}</font></b>】條記錄';
    var sysUserinfoList_grid_bbar = new Ext.PagingToolbar({
      store: sysUserinfoList_grid_store,
      displayMsg: displayMsg,
      emptyMsg: '沒有信息',
      pageSize: 
    10,
      displayInfo: 
    true,
      items: ['
    &nbsp;&nbsp;&nbsp;&nbsp;每頁顯示數', new Ext.form.ComboBox({
        store: 
    new Ext.data.SimpleStore({
          fields: ['abbr', 'state'],
          data: [[
    1010], [1515], [2020], [3030], [4040], [6060], [8080], [100100]]
        }
    ),
        width: 
    50,displayField: 'state',typeAhead: true,mode: 'local',value: 10,triggerAction: 'all',selectOnFocus: true,
        listeners: 
    {
          change: 
    {
            fn: 
    function(box, newValue, oldValue){
              sysUserinfoList_grid_bbar_change_PageSize(newValue);
            }

          }
    ,
          select: 
    {
            fn: 
    function(combo, value){
              
    //sysUserinfoList_grid_bbar_change_PageSize(combo.getValue());
            }

          }

        }

      }
    )]
    }
    );
     
    function sysUserinfoList_grid_bbar_change_PageSize(newValue){
      sysUserinfoList_grid_bbar['pageSize']
    =newValue;
      sysUserinfoList.store.reload(
    { params : { start : 0, limit : newValue } });
    }
    ;
     
    var sysUserinfoList_grid_tbar = [
      
    {xtype:'button',name:'button_addRecord',cls:'x-btn-text-icon',handler:func_button_addRecord,icon:'http://localhost:8080/sie/script/button-icon/icon_add.gif',text:'增加用戶管理',type:'button',id:'button_addRecord'},'-',
      {xtype:'button',name:'button_updateRecord',cls:'x-btn-text-icon',disabled:true,handler:func_button_updateRecord,icon:'http://localhost:8080/sie/script/button-icon/icon_update.gif',text:'修改用戶管理',type:'button',id:'button_updateRecord'},'-',
      {xtype:'button',name:'button_deleteRecord',cls:'x-btn-text-icon',disabled:true,handler:func_button_deleteRecord,icon:'http://localhost:8080/sie/script/button-icon/icon_delete.gif',text:'刪除用戶管理',type:'button',id:'button_deleteRecord'}
    ];
     
    var  sysUserinfoList = new Ext.grid.GridPanel({
      viewConfig: 
    { forceFit: true },
      ds :  sysUserinfoList_grid_store,
      cm : sysUserinfoList_grid_cm,
      selModel : 
    new Ext.grid.RowSelectionModel(),loadMask : true,
      tbar:sysUserinfoList_grid_tbar,
      bbar :  sysUserinfoList_grid_bbar,
      bodyStyle:'width:
    100%',
      url:'http:
    //localhost:8080/sie/txn090902.do',
      name:'sysUserinfoList',region:'center',title:'用戶管理列表',iconCls:'icon-pub1',id:'sysUserinfoList'
    }
    );
     
    sysUserinfoList.on(
    "cellclick"function(){
      
    var records = sysUserinfoList.getSelections();
      
    if (!records || records.length == 0{
        Ext.getCmp(
    "button_updateRecord").disable();
        Ext.getCmp(
    "button_deleteRecord").disable();
      }

      
    if (records.length == 1{
        Ext.getCmp(
    "button_updateRecord").enable();
        Ext.getCmp(
    "button_deleteRecord").enable();
      }

      
    if (records.length > 1{
        Ext.getCmp(
    "button_updateRecord").disable();
        Ext.getCmp(
    "button_deleteRecord").enable();
      }

    }
    );
     
        
    var viewport = new Ext.Viewport({
      layout:'border',
      items:[sysUserinfo,sysUserinfoList]
    }
    );
      
     
    /******************Body內JavaScript代碼輸出結束************************/
    }
    );

    </script> 
    </body> 
     
    </html> 
    posted on 2009-05-04 16:49 王總兵 閱讀(1888) 評論(5)  編輯  收藏 所屬分類: Ext

    評論

    # re: ext的grid和queryForm的整合處理 2009-05-04 17:31 陽衡鋒
    ext 好像有一個taglib吧 http://www.exttld.com/  回復  更多評論
      

    # re: ext的grid和queryForm的整合處理 2009-05-04 17:42 王兵
    @陽衡鋒
    確實有一個 并且還有不少
    我希望我的這個標簽可以和一部分的后臺程序結合起來使用,完成用戶權限的控制。  回復  更多評論
      

    # re: ext的grid和queryForm的整合處理 2009-05-05 13:09 tee
    一直在想,那么多人那么痛苦的要把b/s整成c/s,大量精力都花在了UI而不是業務邏輯上,何必呢?  回復  更多評論
      

    # re: ext的grid和queryForm的整合處理 2009-05-05 13:40 王兵
    @tee
    業務邏輯其實是核心的東西
    但是架構師是不需要關心具體的業務邏輯
    我們公司有自己的產品 自己的平臺、UI、快速開發環境等等
    這些都和業務沒關系   回復  更多評論
      

    # re: ext的grid和queryForm的整合處理[未登錄] 2009-05-07 09:27 陳亮
    我認為用模板比用標簽封裝方便,標簽調試起來太麻煩  回復  更多評論
      

    主站蜘蛛池模板: 亚洲日韩av无码| 久久成人免费播放网站| 亚洲人成7777| 国产aⅴ无码专区亚洲av| 国产无遮挡色视频免费视频| 在线观看免费中文视频| 国产无遮挡裸体免费视频在线观看| 久久水蜜桃亚洲AV无码精品| 国产成人精品日本亚洲11| 777亚洲精品乱码久久久久久| 国产精品国产亚洲精品看不卡| 亚洲精品动漫人成3d在线| 小小影视日本动漫观看免费| 在线看免费观看AV深夜影院| 久久国产精品2020免费m3u8| 国产一级在线免费观看| 一级毛片免费不卡直观看| 国产亚洲精品美女2020久久 | 国产精品免费久久久久久久久| 亚洲国产欧美日韩精品一区二区三区 | 久久av无码专区亚洲av桃花岛| 国产午夜亚洲不卡| 亚洲国产精品人人做人人爽| 日本免费人成黄页在线观看视频| 毛片网站免费在线观看| 野花高清在线观看免费3中文| 久久福利资源网站免费看| 18禁无遮挡无码国产免费网站| 一区二区三区观看免费中文视频在线播放| 国产精品免费在线播放| 国产成人精品免费大全| 一级做性色a爰片久久毛片免费| 春意影院午夜爽爽爽免费| 男人j进女人p免费视频| 一级特黄a免费大片| 黄色视频在线免费观看| 99久久婷婷免费国产综合精品| 中文在线免费不卡视频| 13小箩利洗澡无码视频网站免费| 野花香在线视频免费观看大全| 免费毛片a线观看|