问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501

Ext form + radiogroup问题

发布网友 发布时间:2022-05-05 07:54

我来回答

1个回答

热心网友 时间:2022-04-24 22:03

这是我曾经写的一个人员表查询,里面也有下拉表,你看看对你有用吗?
-----------------------------
Ext.onReady(function(){
Ext.QuickTips.init();

var empFields = new Ext.data.Record.create([
{name:"id",type:"int"},
{name:"name",type:"string"},
{name:"eno",type:"string"},
{name:"sex",type:"string"},
{name:"age",type:"string"},
{name:"deptno",type:"string"},
{name:"birthday",type:"date" ,dateFormat:"Y-n-j"},
{name:"birthplace",type:"string"},
{name:"nationality",type:"string"},
{name:"health",type:"string"},
{name:"marital",type:"string"},
{name:"worktime",type:"string"},
{name:"polity",type:"string"},
{name:"residence",type:"string"},
{name:"indate",type:"date" ,dateFormat:"Y-n-j" },
{name:"officialdate",type:"date" ,dateFormat:"Y-n-j"},
{name:"cellphone",type:"string"},
{name:"idcardno",type:"string"},
{name:"remark",type:"string"}
]);
//var sm = new Ext.grid.CheckboxSelectionModel({handleMouseDown: Ext.emptyFn});

var proxy = new Ext.data.HttpProxy({
url : '../../servlets/DeptServlet?command=findAllDept'
});

var reader = new Ext.data.JsonReader({
root : 'depts'
}, [{
name : 'deptname',
mapping : 'deptname'
},{
name : 'deptno',
mapping : 'deptno'
}]);

var combostore = new Ext.data.Store({
proxy : proxy,
reader : reader
});

combostore.load();

var cproxy = new Ext.data.HttpProxy({
url : '../../servlets/EmpServlet?command=findAllEmpno'
});

var creader = new Ext.data.JsonReader({
root : 'empnos'
}, [{
name : 'empno',
mapping : 'empno'
}]);

var ccombostore = new Ext.data.Store({
proxy : cproxy,
reader : creader
});

ccombostore.load();

//出生日期
var birthField = new Ext.form.DateField({
header: "出生日期",
id:"birthday",
dataIndex:"birthday",
timePicker:true,
allowBlank : false,
renderer:Ext.util.Format.dateRenderer('Y-m-d'),
editor:new Ext.form.DateField({format:"Y-m-d",allowBlank:false,timePicker:true}) //在浏览器的grid里显示的格式
});

var colM = new Ext.grid.ColumnModel([
{header: "序号",
dataIndex:"id",
sortable: true,
width:50
},

{header: "姓名",
dataIndex:"name",
width:50,
editor: new Ext.form.TextField()},
{header: "编号",
dataIndex:"eno",
width:50 },
{header: "性别",
align : 'center',
dataIndex:"sex",
width:40,
disable:true,
editor: new Ext.form.ComboBox({
triggerAction:"all",lazyRender:true,
store:new Ext.data.SimpleStore({ fields:['supName'], data:[['男'],['女']]}),
displayField:'supName',valueField:'supName',typeAhead: true, mode: 'local',
forceSelection:true, selectOnFocus:true
})
},
{header: "年龄",
dataIndex:"age",
width:40,
align : 'center',
editor: new Ext.form.NumberField()},

{header: "所属部门",
dataIndex:"deptno",
width:100,
editor: new Ext.form.ComboBox({
triggerAction:"all",lazyRender:true,
store:combostore ,displayField:'deptname',valueField:'deptname',
typeAhead: true, mode: 'local', forceSelection:true, selectOnFocus:true
})
},
birthField,

{header: "出生地",
dataIndex:"birthplace",
width:60,
editor: new Ext.form.TextField()},
{header: "民族",
dataIndex:"nationality",
width:50,
editor: new Ext.form.TextField()},
{header: "健康状况",
dataIndex:"health",
width:100,
editor: new Ext.form.TextField()},
{header: "婚姻",
dataIndex:"marital",
width:50,
editor: new Ext.form.ComboBox({
triggerAction:"all",lazyRender:true,
store:new Ext.data.SimpleStore({ fields:['supName'], data:[['未婚'],['已婚']]})
, displayField:'supName',valueField:'supName',typeAhead: true, mode: 'local', forceSelection:true, selectOnFocus:true
})
},
{header: "用工期限",
dataIndex:"worktime",
width:100,
editor: new Ext.form.TextField()},
{header: "*面貌",
dataIndex:"polity",
width:100,
editor: new Ext.form.TextField()},
{header: "户口所在地",
dataIndex:"residence",
width:120,
editor: new Ext.form.TextField()},
{header: "聘任日期",
dataIndex:"indate",
allowBlank : false,
renderer:Ext.util.Format.dateRenderer('Y-m-d'),
editor:new Ext.form.DateField({format:"Y-m-d",allowBlank:false,timePicker:true}) //在浏览器的grid里显示的格式
},
{header: "转正日期",
dataIndex:"officialdate",
allowBlank : false,
renderer:Ext.util.Format.dateRenderer('Y-m-d'),
editor:new Ext.form.DateField({format:"Y-m-d",allowBlank:false,timePicker:true}) //在浏览器的grid里显示的格式
},
{header: "移动号码",
dataIndex:"cellphone",
width:100,
editor: new Ext.form.TextField()},
{header: "身份证号码",
dataIndex:"idcardno",
width:120,
editor: new Ext.form.TextField()},
{header: "备注",
dataIndex:"remark",
editor: new Ext.form.ComboBox({
triggerAction:"all",lazyRender:true,
store:new Ext.data.SimpleStore({ fields:['supName'], data:[['在职'],['离职']]})
, displayField:'supName',valueField:'supName',typeAhead: true, mode: 'local', forceSelection:true, selectOnFocus:true
})
}
]);
colM.defaultSortable = true;

var store = new Ext.data.JsonStore({
url:'../../servlets/EmpServlet',
baseParams:{qname:'',qeno:'',qdeptno:'',command:'query'},
totalProperty:'count',
root:'emps',
fields:empFields,
pruneModifiedRecords:true,
sortInfo: {field: "id", direction: "ASC"}
});

var qnameField = new Ext.form.TextField({
fieldLabel:'姓名',
id:'qname',
name:'qname',
anchor:'100%'
});
var qenoField = new Ext.form.ComboBox({
fieldLabel:'编号',
id:'qeno',
name:'qeno',
store:ccombostore,
anchor:'100%',
triggerAction:"all",lazyRender:true,
displayField:'empno',valueField:'empno',
typeAhead: true, mode: 'local', forceSelection:true,
selectOnFocus:true
});
var qdeptnoField = new Ext.form.ComboBox({
fieldLabel:'所属部门',
id:'qdeptno',
name:'qdeptno',
store:combostore,
anchor:'100%',
triggerAction:"all",lazyRender:true,
displayField:'deptname',valueField:'deptname',
typeAhead: true, mode: 'local', forceSelection:true,
selectOnFocus:true
});
var btnSearch = new Ext.Button({
text:'查询',
iconCls:'search',
disabled:pri,
handler:function(){
if(qnameField.isValid() && qenoField.isValid()&& qdeptnoField.isValid()){
store.baseParams.qname=qnameField.getValue();
store.baseParams.qeno=qenoField.getValue();
store.baseParams.qdeptno=qdeptnoField.getValue();
}
store.load({params:{start:0,limit:20}});
}
});
var linkButton = new Ext.Button({
text: '导出到Excel',
iconCls:'toexcel',
handler: function() {
var vExportContent = grid.getExcelXml();
if (Ext.isIE6 || Ext.isIE7 || Ext.isIE8 || Ext.isSafari || Ext.isSafari2 || Ext.isSafari3) {
var fd=Ext.get('frmDummy');
if (!fd) {
fd=Ext.DomHelper.append(Ext.getBody(),{tag:'form',method:'post',id:'frmDummy',action:'../exportexcel.jsp', target:'right',name:'frmDummy',cls:'x-hidden',cn:[
{tag:'input',name:'exportContent',id:'exportContent',type:'hidden'}
]},true);
}
fd.child('#exportContent').set({value:vExportContent});
fd.dom.submit();
} else {
document.location = 'data:application/vnd.ms-excel;base64,'+Base64.encode(vExportContent);
}}
});

//表单窗体
var memberAddWindow;
var PassAddWindow;

var grid = new Ext.grid.EditorGridPanel({
renderTo:"showGrid",
title: "职员基本信息",
height: 680,
width: 1000,
cm: colM,
store: store,
frame:true,
clicksToEdit:1,
loadMask: true,
stripeRows:true,

tbar:[
{// 添加按钮
text:'添加',
iconCls:'user_add',
disabled:pri,
handler:function(){
var ef = new empFields({
name:'新员工',
sex:'男',
birthday:new Date(),
eno:'无',
age:'无',
deptno:'无',
birthplace:'无',
nationality:'无',
health:'良好',
marital:'未婚',
worktime:'3个月',
polity:'无',
residence:'无',
indate:new Date(),
officialdate:new Date(),
cellphone:'无',
idcardno:'无',
remark:'在职'
});
grid.stopEditing();
store.insert(0, ef);
grid.startEditing(0, 2);
store.getAt(0).dirty=true; // 设置该行记录为脏数据(默认为非脏数据),否则在保存时将无法判断该行是否已修改
}
},'-',
{//保存按钮
text:'保存',
iconCls:'save',
disabled:pri,
handler:function(){
var json = [];
for(i=0,cnt=store.getCount();i<cnt;i+=1){
var record = store.getAt(i);
if(record.dirty) // 得到所有修改过的数据
json.push(record.data);
}
if(json.length==0){
Ext.Msg.alert('信息','没有对数据进行任何更改');
return;
}

//发送保存请求
Ext.lib.Ajax.request(
'POST',
'../../servlets/EmpServlet',{
success:function(request){
var message = request.responseText;
Ext.Msg.alert('信息',message);
store.reload();
//grid.getView().refresh();
},
failure:function(request){
var message = request.responseText;
Ext.Msg.alert("错误", message);
}
},
'command=save&emps='+encodeURIComponent(Ext.encode(json))
);

}
},'-',
{
id:'newWindowButton',
text:'修改密码',
iconCls:'reset',
handler:function(){
showMemerAddWindow(); //显示表单所在窗体
}
},'-',
{
id:'newWindowButton2',
text:'修改密保',
iconCls:'reset',
handler:function(){
showPassAddWindow(); //显示表单所在窗体
}
},'-',
'姓名:',qnameField,'编号:',qenoField,'部门:',qdeptnoField,btnSearch,linkButton
],

bbar: new Ext.PagingToolbar({
pageSize: 20,
store: store,
displayInfo: true,
displayMsg: "显示第 <span style='color:red;'>{0}</span> 条到 <span style='color:red;'>{1}</span> 条记录,一共 <span style='color:red;'>{2}</span> 条",
emptyMsg: "<span style='color:red;'>没有记录</span>"
})
});

grid.on("afterEdit", afterEdit, grid);
function afterEdit(obj){
var r = obj.record;//获取被修改的行
var l = obj.field;//获取被修改的列

var indate = r.get("indate");
var birthday = r.get("birthday");
var officialdate = r.get("officialdate");
if(indate == ""){
alert('聘任日期不能为空!');
return;
}
if(birthday == ""){
alert('出生日期不能为空!');
return;
}
if(officialdate == ""){
alert('转正日期不能为空!');
return;
}
}
store.load({params:{start:0,limit:20}});

/**
* 以下是修改密码表单 __________________________________________________
* */

var oldpwdField = new Ext.form.TextField({
fieldLabel:'原密码',
name:'oldpwd',
inputType:'password',
allowBlank:false,
anchor:'90%'
});

var newpwdField = new Ext.form.TextField({
fieldLabel:'新密码',
name:'newpwd',
inputType:'password',
allowBlank:false,
anchor:'90%'
});

var repwdField = new Ext.form.TextField({
fieldLabel:'重复密码',
name:'repwd',
inputType:'password',
allowBlank:false,
anchor:'90%'
});

//表单对象
var memberForm = new Ext.FormPanel({
labelAlign: 'top',
frame:true,
title: '修改密码',
width: 300,
url:'../../servlets/UserServlet?command=changepwd',

items: [{
layout:'column',// 该FormPanel的layout布局模式为列模式(column),包含2列
items:[
{//第一列
columnWidth:0.8,
layout: 'form',
items: [oldpwdField,newpwdField,repwdField]
}]
}],
buttons:[{
text:'提交',
handler:function(){
if(memberForm.getForm().isValid())
memberForm.getForm().submit({
waitMsg:'保存中,请稍后...',
success:function(){
memberForm.getForm().reset();
Ext.Msg.alert("修改成功!");
memberAddWindow.hide();
store.reload();
},
failure:function(){
memberForm.getForm().reset();
Ext.Msg.alert("修改失败,请确定输入正确!");
memberAddWindow.hide();
store.reload();
}
});
}
},{
text:'取消',
handler:function(){
memberForm.getForm().reset();
memberAddWindow.hide();
}
}]
});

//窗体对象
function showMemerAddWindow(){
if(!memberAddWindow){
memberAddWindow = new Ext.Window({
// el:'window_win',
layout:'fit',
width:300,
height:250,
closable:true,
closeAction:'hide',
plain:true,
items: [memberForm]
});
}
memberAddWindow.show();
}

/**
* 以下是修改密保表单 __________________________________________________
* */

var passpro = new Ext.form.TextField({
fieldLabel:'密保',
name:'passpro',
allowBlank:false,
anchor:'90%'
});

//表单对象
var PassForm = new Ext.FormPanel({
labelAlign: 'top',
frame:true,
title: '修改密保',
width: 300,
url:'../../servlets/UserServlet?command=changepro',

items: [{
layout:'column',// 该FormPanel的layout布局模式为列模式(column),包含2列
items:[
{//第一列
columnWidth:0.8,
layout: 'form',
items: [passpro]
}]
}],
buttons:[{
text:'提交',
handler:function(){
if(PassForm.getForm().isValid())
PassForm.getForm().submit({
waitMsg:'保存中,请稍后...',
success:function(){
PassForm.getForm().reset();
Ext.Msg.alert("修改成功!");
PassAddWindow.hide();
store.reload();
},
failure:function(){
PassForm.getForm().reset();
Ext.Msg.alert("修改失败,请确定输入正确!");
PassForm.hide();
store.reload();
}
});
}
},{
text:'取消',
handler:function(){
PassForm.getForm().reset();
PassAddWindow.hide();
}
}]
});

//窗体对象
function showPassAddWindow(){
if(!PassAddWindow){
PassAddWindow = new Ext.Window({
// el:'window_win',
layout:'fit',
width:300,
height:250,
closable:true,
closeAction:'hide',
plain:true,
items: [PassForm]
});
}
PassAddWindow.show();
}

});
声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
...结构的施工分包给其他单位那么是不是EPC总承包就不能分包 Win11玩不了地平线4如何解决_Win11玩不了地平线4怎么办 Win11玩不了地平线4如何解决_Win11玩不了地平线4怎么解决 地平线5警告显卡内存过低怎么办 极限竞速地平线5闪退怎么解决 极限竞速地平线5闪退解决方法 怎样册除手机屏幕上(精品游戏)图标 烧结普通砖有哪些 烧结普通砖都有哪些 ...4年后的年龄与弟弟3年前的年龄和是35岁。今年哥与弟各几岁??_百度... ...等于弟弟7年后的年龄,哥哥4年后与弟弟3年前的年龄的和是35岁。哥哥... 请问delphi(ADO+ODBC+MYSQL)怎样动态创建 MySQL存储过程? 使用Ext 4.0 表单提交方式,其中textfield 设置默认值value为0,当我前台... 蜗牛可以放在热水里吗 Ext.form.TextField 添加事件 extjs 表单的textfield想直接用数据库中的字段写入textfield,而不是自己直接输入,该怎么写啊? 在EXTJS中,我需要把一个Panel中的几个textfield文本框居中 或者居右排... 蜗牛会游泳吗?放水里会淹死吗? ExtJS中一个textfield 通过setValue()后.但提交表单时,且得不到这个t... 蜗牛完全浸在水中会不会死?蜗牛是怎么呼吸的呢? 夏威夷椰子树怎么养,夏威夷椰子的养殖方法和注意事项 ext-js 隐藏TextField后,如何恢复显示的问题 海南椰子树上好多松鼠,我怎么能抓到它? 蜗牛为什么喜欢在2厘米的水里泡着? 办公室植物小椰子树的种植技巧 如何爬上椰树 门锁不好开是因为锁芯的问题,还是门不和缝的问题? 家里的门锁从外边钥匙拧不动,从里边可以打开,是锁芯坏了吗 如何恢复手机缓存 防盗门之前一直都能在外面反锁,突然现在不能在外面反锁了,这是怎么回事呢?锁芯坏了还是其他原因呢? 汽车打火锁芯坏是什么原因造成的 Ext当输入查询条件的时候,为什么就报错 “对象不支持此属性或方法 ext... extjs中,如何在textfield后面加一个按钮,并且点击按钮要调用后台方法... Extjs问题,我想居中显示字段,但他一直是居左显示,代码如下 :_百度知... ext中,一个PANEL中的控件如何获取另一个panel中的值 ExportBigApplyExcel... ExtJS 动态增加与删除items,动态设置textField可见与否 ...如何往中间添加TextField/combobox等Ext控件 C#中hide()方法visible=false 有什么区别呀,是不是完全相同呀! ext datefield中的fieldlabel现实不正常 Java jFrame中窗体的使用setVisible(false)后窗体不隐藏该怎么解决?(附测试源码) 垫江巴人咂黄精酒38度500毫升价格 请问ext 里的textfield 隐藏那前面的label属性 成都市国学经典诵读读本 初中 成都市国学经典诵读读本 初中答案 《中小学国学经典诵读丛书》内容编排怎么样啊? 阅读下列材料,回答后面的问题。  成都市中小学正掀起“国学经典诵读活动”的*,不少学校,正大力开 语文出版社出版的《中小学国学经典诵读丛书》之古诗词经典读本包含哪些书籍呢? 阅读下列材料,回答后面的问题。成都市中小学正掀起“国学经典诵读活动”的*,不少学校正大力开展国学 安装不了新浪微博,下载了好多次几个版本都显示未安装应用程序。 语文出版社出版的《中小学国学经典诵读丛书》都有哪些图书呀,了解的朋友给说一说? 有人知道语文出版社出版的《中小学国学经典诵读丛书》一套都是有哪些吗?