首頁 > web前端 > js教程 > 主體

Extjs 4.x 得到form CheckBox 复选框的值_extjs

WBOY
發布: 2016-05-16 16:50:06
原創
1159 人瀏覽過

CheckBox(复选框)主要用来接收用户选择的选项

如图所示(请忽略UI的不好看):

Extjs 4.x 得到form CheckBox 复选框的值_extjs

该弹出窗口的主要代码如下:

复制代码 代码如下:

var win = new Ext.Window({
modal : true,
title : '确定要拒绝该表吗?',
width : 500,
plain : true,
items : [fp]
});
win.show();

弹出的窗口是载体,items里面的[fp]是form表单的句柄。

具体定义如下:
复制代码 代码如下:

var fp = Ext.create('Ext.FormPanel', {
frame: true,
fieldDefaults: {
labelWidth: 110
},
width: 500,
bodyPadding: 10,
items: [
{
xtype: 'fieldset',
flex: 1,
//title: '确定要拒绝该张表吗?',
defaultType: 'checkbox',
layout: 'anchor',
defaults: {
anchor: '100%',
hideEmptyLabel: false
},
items:[{
fieldLabel: '请选择拒绝原因:',
boxLabel: '该表没有填写完整。',
name:'integrity',
inputValue: '1'
}, {
name:'correct',
boxLabel: '该表填写不准确。',
inputValue: '1'
}]
}],
buttons: [
{text: '确认',handler: function(){
//得到完整性和准确性信息 有则为1 没有为0
if(fp.getForm().isValid()){                 
console.log(fp.getForm().findField('integrity').getValue()?1:0);
console.log(fp.getForm().findField('correct').getValue()?1:0)
}
win.hide();
}
},{
text: '取消',
handler: function(){
   win.hide();
 }
  }]
  });

这里面基本涵盖了所有的感兴趣的信息。具体的参见API吧本身不难

着重说下得到checkBox的值
复制代码 代码如下:

console.log(fp.getForm().findField('integrity').getValue()?1:0);
console.log(fp.getForm().findField('correct').getValue()?1:0)

这两句话就是如何得到完整性和正确性的值。
相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!