0 0

急求,Ext如何根据条件在控制层或者视图层的文本值5

view层:

tbar:[
{xtype:'button',text:'添加',id:'sch_add', iconCls:'Applicationformadd' },
{xtype:'button',text:'删除',id:'sch_delete',iconCls:'Applicationformdelete'},
{xtype:'button',text:'修改',id:'sch_edit',iconCls:'Applicationformedit'},
{xtype:'button',text:'导入',id:'sch_in',iconCls:'Diskdownload'},
{xtype:'button',text:'导出',id:'sch_out',iconCls:'Diskupload' } ,
' | ',

{xtype:'textfield',fieldLabel : '请输入学校',labelAlign : 'right',name:'schoolName', id:'schoolName'},
{xtype:'button',text:'查看',id:'sch_magnify',iconCls:'Applicationformmagnify' }

],







控制层:selectSchool:function(o){
//var win = o.up('window');
//form = win.down('form');
//record = form.getRecord();
//values = form.getValues();
//if((JSON.stringify(values))[35]!='i'){
var gird = o.ownerCt.ownerCt;
var values = gird.getSelectionModel().getSelection();
alert(values);
var value=values.get('schoolName');
alert(value);
var textFieldObject=Ext.getCmp('schoolName').setValue(value);
alert(textFieldObject);

/*alert((JSON.stringify(values)));
if((JSON.stringify(values)).length>169){//判断第长度是否大于总空字符串长度,如果是返回true,否则返回false
var sch =JSON.stringify(values);// Ext.encode(values);


Ext.Ajax.request({
url: 'struts2/school_save.action',
params: {
sch:sch
},
method : 'POST',
success: function(form, action) {
var store = Ext.getStore("Schools");
store.reload();
win.close();     
},
failure: function(form, action) {
Ext.Msg.alert('Failure', action.result.msg);
}   
});
}else{ Ext.Msg.alert("提示","请填满所有的数据");//提示信息,数据填满才能运行
}*/
}
2014年1月08日 14:10
目前还没有答案

相关推荐

Global site tag (gtag.js) - Google Analytics