论坛首页 入门技术论坛

extjs-tag (即使不会extjs和js也能开发页面)

浏览 31713 次
该帖已经被评为新手帖
作者 正文
   发表时间:2009-06-18  
我也是这么在用的.感觉还行
0 请登录后投票
   发表时间:2009-06-18  
同样不看好楼主的做法.去年我写了好几个月的struts2标签,非常不喜欢freeMark.感觉还不如直接写js来的方便.再说js都觉得难学的话,也没有什么别的语言更容易了.
0 请登录后投票
   发表时间:2009-06-18  
下面是我的extjsptags的一段代码,其中jsp如下:
<%@ page contentType="text/html;charset=UTF-8" %>

<%@ include file="/commons/taglibs.jsp" %>

<gw:html>
<gw:head>
<base href="${ctx}/${basePath}">
<gw:title caption="用户管理"/>
<%@ include file="/commons/button-icon.jsp"  %>
</gw:head>
  
<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('txn990103.do',200,600);
page.addGridValue('userId','sysUserinfoList:userId');
page.goPage();
}
//删除记录
function func_button_deleteRecord(){
var page = new pageDefine('txn990106.do');
page.addGridValues('userId','sysUserinfoList:userId');
page.deleteRecord('确认删除选中的记录?','sysUserinfoList');

</script>
<gw:body>

<gw:viewport>
<gw:block title="查询用户管理"   name="sysUserinfo" columns="2"  height="150" region="north" >
<gw:text name="username" fieldLabel="用户名"   colspan="1"   />
<gw:timebox name="email1" 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="userId" rownum="false" checkbox="true" url="txn990102.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="userId" header="用户表ID"  hidden="true"   />
<gw:cell dataIndex="username"    header="用户名"   />
<gw:cell dataIndex="email" header="电子邮箱"  />
<gw:cell dataIndex="add_time" header="添加日期"  />
</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/extjsptags/script/ext/ext-base.js" type="text/javascript"></script>
<script src="http://localhost:8080/extjsptags/script/ext/ext-all.js" type="text/javascript"></script>
<script src="http://localhost:8080/extjsptags/script/ext/ext-lang-zh_CN.js" type="text/javascript"></script>
<link href="http://localhost:8080/extjsptags/script/ext/resources/css/ext-all.css" type="text/css" rel="stylesheet">
<script src="http://localhost:8080/extjsptags/script/extjsptag-form.js" type="text/javascript"></script>
<script src="http://localhost:8080/extjsptags/script/extjsptag-public.js" type="text/javascript"></script>
<script src="http://localhost:8080/extjsptags/script/extjsptag-grid.js" type="text/javascript"></script>
<script src="http://localhost:8080/extjsptags/script/extjsptag-page.js" type="text/javascript"></script>
<script src="http://localhost:8080/extjsptags/script/extjsptag-select.js" type="text/javascript"></script>

<script src="http://localhost:8080/extjsptags/script/extjsptag-tree.js" type="text/javascript"></script>

<base href="/extjsptags/module/yhqxgl/sys_userinfo/">
<title>用户管理</title>

<style>
.icon_add {
  background: url('/extjsptags/script/button-icon/icon_add.gif') 0 2 no-repeat   !important;
}
.icon_delete {
  background: url('/extjsptags/script/button-icon/icon_delete.gif') 0 2 no-repeat  !important;
}
.icon_update {
  background: url('/extjsptags/script/button-icon/icon_update.gif')  0  2 no-repeat  !important;
}
.icon-pub1 {
  background: url('/extjsptags/script/button-icon/icon-pub1.gif')  0 0  no-repeat  !important;
}  
*{font-size:14px;}
</style>
</head>

  
<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('txn990103.do',200,600);
page.addGridValue('userId','sysUserinfoList:userId');
page.goPage();
}
//删除记录
function func_button_deleteRecord(){
var page = new pageDefine('txn990106.do');
page.addGridValues('userId','sysUserinfoList:userId');
page.deleteRecord('确认删除选中的记录?','sysUserinfoList');

</script>
<body>
<script>

var pWinCmpId = null;

Ext.BLANK_IMAGE_URL = 'http://localhost:8080/extjsptags/script/ext/resources/images/default/s.gif';
var basePath = 'http://localhost:8080/extjsptags/module/yhqxgl/sys_userinfo/';
var rootPath = 'http://localhost:8080/extjsptags/';

Ext.onReady(function() {

Ext.QuickTips.init();
Ext.form.Field.prototype.msgTarget = 'qtip';


/******************下面开始Body内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_email1',id:'sysUserinfo_item_email1',
  colspan:2,bodyStyle:'padding:2px',
  width:sysUserinfo_perWidth*2,
  items:{
    xtype:'timefield',name:'email1',anchor:'100%',fieldLabel:'电子邮箱',id:'email1'
  }
});



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_email1").setWidth(_perWidth * 2-15);
});












var sysUserinfoList_grid_record = Ext.data.Record.create([
  {name:'userId',type:'string'},
  {name:'username',type:'string'},
  {name:'email',type:'string'},
  {name:'add_time',type:'string'}
]);

var sysUserinfoList_grid_store = new Ext.data.Store({
  proxy : new Ext.data.HttpProxy({url : 'http://localhost:8080/extjsptags/txn990102.do'}),
  reader : new Ext.data.JsonReader({root : 'result',totalProperty : 'totalCount',id : 'userId'}, sysUserinfoList_grid_record)
});

var sysUserinfoList_grid_sm = new Ext.grid.CheckboxSelectionModel({dataIndex : 'userId'});
var sysUserinfoList_grid_cm = new Ext.grid.ColumnModel([
  sysUserinfoList_grid_sm,
  {dataIndex:'userId',hidden:true,type:'string',header:'用户表ID'},
  {dataIndex:'username',type:'string',header:'用户名'},
  {dataIndex:'email',type:'string',header:'电子邮箱'},
  {dataIndex:'add_time',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: [[10, 10], [15, 15], [20, 20], [30, 30], [40, 40], [60, 60], [80, 80], [100, 100]]
    }),
    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']=parseInt(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/extjsptags/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/extjsptags/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/extjsptags/script/button-icon/icon_delete.gif',text:'删除用户管理',type:'button',id:'button_deleteRecord'}
];

var  sysUserinfoList = new Ext.grid.EditorGridPanel({
  viewConfig: { forceFit: true },clicksToEdit:1,
  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/extjsptags/txn990102.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_bbf711369508430c820c941331e61afd = new Ext.Viewport({
  layout:'border',
  items:[sysUserinfo,sysUserinfoList]
});
 

try{doPageInit();}catch(e){}

/******************Body内JavaScript代码输出结束************************/
});
</script>

</body>

</html>



0 请登录后投票
   发表时间:2009-06-18  
bingxue2332 写道
下面是我的extjsptags的一段代码,其中jsp如下:
<%@ page contentType="text/html;charset=UTF-8" %>

<%@ include file="/commons/taglibs.jsp" %>

<gw:html>
<gw:head>
<base href="${ctx}/${basePath}">
<gw:title caption="用户管理"/>
<%@ include file="/commons/button-icon.jsp"  %>
</gw:head>
  
<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('txn990103.do',200,600);
page.addGridValue('userId','sysUserinfoList:userId');
page.goPage();
}
//删除记录
function func_button_deleteRecord(){
var page = new pageDefine('txn990106.do');
page.addGridValues('userId','sysUserinfoList:userId');
page.deleteRecord('确认删除选中的记录?','sysUserinfoList');

</script>
<gw:body>

<gw:viewport>
<gw:block title="查询用户管理"   name="sysUserinfo" columns="2"  height="150" region="north" >
<gw:text name="username" fieldLabel="用户名"   colspan="1"   />
<gw:timebox name="email1" 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="userId" rownum="false" checkbox="true" url="txn990102.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="userId" header="用户表ID"  hidden="true"   />
<gw:cell dataIndex="username"    header="用户名"   />
<gw:cell dataIndex="email" header="电子邮箱"  />
<gw:cell dataIndex="add_time" header="添加日期"  />
</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/extjsptags/script/ext/ext-base.js" type="text/javascript"></script>
<script src="http://localhost:8080/extjsptags/script/ext/ext-all.js" type="text/javascript"></script>
<script src="http://localhost:8080/extjsptags/script/ext/ext-lang-zh_CN.js" type="text/javascript"></script>
<link href="http://localhost:8080/extjsptags/script/ext/resources/css/ext-all.css" type="text/css" rel="stylesheet">
<script src="http://localhost:8080/extjsptags/script/extjsptag-form.js" type="text/javascript"></script>
<script src="http://localhost:8080/extjsptags/script/extjsptag-public.js" type="text/javascript"></script>
<script src="http://localhost:8080/extjsptags/script/extjsptag-grid.js" type="text/javascript"></script>
<script src="http://localhost:8080/extjsptags/script/extjsptag-page.js" type="text/javascript"></script>
<script src="http://localhost:8080/extjsptags/script/extjsptag-select.js" type="text/javascript"></script>

<script src="http://localhost:8080/extjsptags/script/extjsptag-tree.js" type="text/javascript"></script>

<base href="/extjsptags/module/yhqxgl/sys_userinfo/">
<title>用户管理</title>

<style>
.icon_add {
  background: url('/extjsptags/script/button-icon/icon_add.gif') 0 2 no-repeat   !important;
}
.icon_delete {
  background: url('/extjsptags/script/button-icon/icon_delete.gif') 0 2 no-repeat  !important;
}
.icon_update {
  background: url('/extjsptags/script/button-icon/icon_update.gif')  0  2 no-repeat  !important;
}
.icon-pub1 {
  background: url('/extjsptags/script/button-icon/icon-pub1.gif')  0 0  no-repeat  !important;
}  
*{font-size:14px;}
</style>
</head>

  
<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('txn990103.do',200,600);
page.addGridValue('userId','sysUserinfoList:userId');
page.goPage();
}
//删除记录
function func_button_deleteRecord(){
var page = new pageDefine('txn990106.do');
page.addGridValues('userId','sysUserinfoList:userId');
page.deleteRecord('确认删除选中的记录?','sysUserinfoList');

</script>
<body>
<script>

var pWinCmpId = null;

Ext.BLANK_IMAGE_URL = 'http://localhost:8080/extjsptags/script/ext/resources/images/default/s.gif';
var basePath = 'http://localhost:8080/extjsptags/module/yhqxgl/sys_userinfo/';
var rootPath = 'http://localhost:8080/extjsptags/';

Ext.onReady(function() {

Ext.QuickTips.init();
Ext.form.Field.prototype.msgTarget = 'qtip';


/******************下面开始Body内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_email1',id:'sysUserinfo_item_email1',
  colspan:2,bodyStyle:'padding:2px',
  width:sysUserinfo_perWidth*2,
  items:{
    xtype:'timefield',name:'email1',anchor:'100%',fieldLabel:'电子邮箱',id:'email1'
  }
});



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_email1").setWidth(_perWidth * 2-15);
});












var sysUserinfoList_grid_record = Ext.data.Record.create([
  {name:'userId',type:'string'},
  {name:'username',type:'string'},
  {name:'email',type:'string'},
  {name:'add_time',type:'string'}
]);

var sysUserinfoList_grid_store = new Ext.data.Store({
  proxy : new Ext.data.HttpProxy({url : 'http://localhost:8080/extjsptags/txn990102.do'}),
  reader : new Ext.data.JsonReader({root : 'result',totalProperty : 'totalCount',id : 'userId'}, sysUserinfoList_grid_record)
});

var sysUserinfoList_grid_sm = new Ext.grid.CheckboxSelectionModel({dataIndex : 'userId'});
var sysUserinfoList_grid_cm = new Ext.grid.ColumnModel([
  sysUserinfoList_grid_sm,
  {dataIndex:'userId',hidden:true,type:'string',header:'用户表ID'},
  {dataIndex:'username',type:'string',header:'用户名'},
  {dataIndex:'email',type:'string',header:'电子邮箱'},
  {dataIndex:'add_time',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: [[10, 10], [15, 15], [20, 20], [30, 30], [40, 40], [60, 60], [80, 80], [100, 100]]
    }),
    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']=parseInt(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/extjsptags/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/extjsptags/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/extjsptags/script/button-icon/icon_delete.gif',text:'删除用户管理',type:'button',id:'button_deleteRecord'}
];

var  sysUserinfoList = new Ext.grid.EditorGridPanel({
  viewConfig: { forceFit: true },clicksToEdit:1,
  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/extjsptags/txn990102.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_bbf711369508430c820c941331e61afd = new Ext.Viewport({
  layout:'border',
  items:[sysUserinfo,sysUserinfoList]
});
 

try{doPageInit();}catch(e){}

/******************Body内JavaScript代码输出结束************************/
});
</script>

</body>

</html>




楼上的代码好恐怖。。。写个简单的页面程序,的确是很容易,一旦交互的场景很严格的话,简单的html+js很难做得完美,而复杂如extjs的学习成本也比较高。。。怎么做都感觉难。。。。
0 请登录后投票
   发表时间:2009-06-18  
Ext的维护难度在于1.Ext的语法.2.复杂的逻辑结构.
我最近也在构想一套方案,将Ext的定义和逻辑分开.
这样,定义部分就是语法部分.逻辑部分就是javascript了.
维护部分多数情况是是对javascript进行处理.
这样就降低了难度和耦合.
0 请登录后投票
   发表时间:2009-06-18  
非常好的解决方案。我也正在考虑中。单纯的写ext太麻烦了。
0 请登录后投票
   发表时间:2009-06-18  
对任何试图掩盖JavaScript的工具都不感冒(除了rjs看起来很美)。手写JavaScript很爽。Ext的jsp tag我也封装过,想足够灵活不可能;扩展、维护是噩梦。
0 请登录后投票
   发表时间:2009-06-18  
楼主想法还是不错的呢~!
0 请登录后投票
   发表时间:2009-06-18  
我觉得可以扩展一些适合自己项目的组件,很多实现细节你可以在组件里封装起来,这样培训成本也不会高
0 请登录后投票
   发表时间:2009-06-18  
LZ,你简直就是无理取闹

我觉的你作的真的很不实用


1 请登录后投票
论坛首页 入门技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics