怎样动态设置表单里button属性

千叶玫瑰 2011-04-30 05:07:26
缺省设置button不可用,怎样在getlogid()设置button可用?


setT = new Ext.form.FieldSet({
// title:'fieldset',
//width:400,
autoHeight:true,
autoWidth:true,
// columnWidth: 1,
layout: 'column',
border:false,
anchor:'100%',
labelWidth: 60,
items:[{
columnWidth:.2,
layout: 'form',
border:false,
items: [
{
columnWidth:.69,
layout: 'form',
border:false,
items: [{
xtype:'textfield',
fieldLabel: '设备维护保养记录',
name: 'byjl',
value:' 经 查 各 服 务 器 及 网 络 均 正 常',
anchor:'98%'
}]
},{
columnWidth:.3,
layout: 'form',
border:false,
items: [{
xtype: 'lovcombo',
fieldLabel: '值班人员',
name: 'zbryt',
store:whryStore,
/*store: new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url:Srvt + '?method=cmbUsername'}),
reader: new Ext.data.ArrayReader({},[
{name:'value'},
{name:'text'}
])
}),*/
mode: 'remote',
triggerAction: 'all',
valueField: 'value',
displayField: 'text',
editable : true,
hiddenName:'zbry',
anchor:'99%'
}]
},{
columnWidth:.3,
layout: 'form',
border:false,
items: [{
xtype:'button',
text:'query',
//disabled:true,
id:"query",
//iconCls: 'calendar',
handler: function(){
},
scope: this
}]
}]
});

setTform = new Ext.form.FormPanel({
height: 90,
border: false,
labelWidth:60,
labelAlign:'right',
frame:true,
autoWidth : true,
autoScroll:true,
// hideBorder:true,
url:Srvt + '?method=insert',
items:[setT]
});
function getLogid(){//setTform的附属函数。根据班次、单位、日期确定本日志是否已填写过。是:调出追加;否:插入本日志
var sbpartid=setTform.getForm().findField('sbpartid').getValue();
var bcid=setTform.getForm().findField('bc').getValue();
var rq=Ext.util.Format.date(setTform.getForm().findField('rq').getValue(),"y-m-d");
Ext.Ajax.request({
url:Srvt + '?method=isLog',
params:{sbpartid:sbpartid,bcid:bcid,rq:rq},
success: function(response, options) {
var responseArray = Ext.util.JSON.decode(response.responseText);
//Ext.Msg.alert('信息', responseArray.list[0].id);
if(responseArray.success == true){
//缺省设置button不可用,怎样在这里设置button可用?
//setTform.getForm().findField('byjl').enable();
//Ext.get('query').dom.disabled=false;
query.disabled=false;
//setTform.getForm().findField('logid').setValue(responseArray.id);

if(responseArray.totalSize==1){//已存在则把相关值赋给表单
mylogid=responseArray.list[0].id;
setTform.getForm().findField('sbry').setValue(responseArray.list[0].sbry);
setTform.getForm().findField('byjl').setValue(responseArray.list[0].byjl);
setTform.getForm().findField('zbry').setValue(responseArray.list[0].zbry);
setTform.getForm().findField('logid').setValue(mylogid);
masGrid.store.load({params:{start:0,limit:pagesize,logid:mylogid}});
} else{
mylogid=responseArray.id;
Ext.MessageBox
.confirm(
'确认',
'确定要填写新日志?',
function(btn) {
if (btn == 'yes') {//填写新日志。设置grid可以使用
Ext.Ajax.request({
url:Srvt + '?method=insert',
params:{sbpartid:sbpartid,bcid:bcid,rq:rq},
success: function(response, options) {
var responseArray = Ext.util.JSON.decode(response.responseText);
if(responseArray.success == true){ //设置grid可以使用
mylogid=responseArray.logid;
setTform.getForm().findField('logid').setValue(mylogid);
masGrid.store.load({params:{start:0,limit:pagesize,logid:mylogid}});
}else{//填写新日志失败。设置grid不可以使用
Ext.Msg.alert('信息', "error");
}
},
failure:function()
{
Ext.Msg.alert( "注册失败!");
}

});
}else{//不填写新日志。设置grid不可以使用
setTform.getForm().findField('logid').setValue("");
setTform.getForm().findField('sbry').setValue("");
setTform.getForm().findField('zbry').setValue("");
masGrid.store.removeAll();
}

});//%$%$%$%$%$%$
}
}else{//用户名可以注册
Ext.Msg.alert('信息', "error");
}
},
failure:function()
{
Ext.Msg.alert( "注册失败!");
}

});
}
...全文
106 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
toury 2011-04-30
  • 打赏
  • 举报
回复
function getLogid(){
document.getElementById("BUTTON的id").disabled=false;
}

87,914

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧