导航:首页 > 编程语言 > extjs给checkbox赋值

extjs给checkbox赋值

发布时间:2023-06-15 02:54:59

㈠ EXTjs怎么给combox赋值

if(typeof(InitData)=='undefined'||InitData==null){InitData={};}

InitData.Terminal={
terminalNos:[{id:'',name:'全部'}]//下拉框终端号
}
//从后台取值
InitData.init=function(){
//初始数据的取得
Com.Ajax.createAjaxRequest({
url:'Data/GetTerminalData',
succFn:function(obj){
for(vari=0,max=obj.data.items.length;i<max;i++){
varter=obj.data.items[i];
InitData.Terminal.terminalNos.push({id:ter.id,name:ter.name});
}
}
});
}


//数据源

vart_store=Ext.create('Ext.data.Store',{
fields:['id','name'],
data:InitData.Terminal.terminalNos,
proxy:{
type:'memory',
reader:{
type:'json',
root:'items'
}
}
});
vartercombo=Ext.create('Ext.form.ComboBox',{//条件:终端编号
fieldLabel:'终端编号',
id:id_combo_terminal,
name:'slipInfo.Terminal',
labelWidth:80,
width:278,
value:'',//设置默认选中值
store:t_store,
editable:false,//设置为只可选择,不可编辑
queryMode:'local',//本地数据时使用'local'
//triggerAction:'all',
valueField:'id',
isplayField:'name'
});
c#后台
List<Hashtable>list=newList<Hashtable>();
HashtablertnVal=newHashtable();
List<string>terlist=Common.TerminalNo.TERMINAL_LIST;

if(terlist!=null)
{
for(inti=0;i<terlist.Count();i++)
{
Hashtableht=newHashtable();
ht["id"]=terlist[i];
ht["name"]=terlist[i];
list.Add(ht);
}
}
rtnVal["totalcount"]=terlist.Count();
rtnVal["items"]=list;
returnCreateJsonResult(true,data:rtnVal);

javascript中,checkbox的赋值

我根据xxq8210写的改出来的:
<body>
<form name="myform" method="post">
<div id="divF">
<input type="checkbox" name="checkboc" value="2" onclick="showAndCount('checkboc')">2<br />
<input type="checkbox" name="checkboc" value="3" onclick="showAndCount('checkboc')">3<br />
<input type="checkbox" name="checkboc" value="4" onclick="showAndCount('checkboc')">4<br />
<input type="checkbox" name="checkboc" value="2.5" onclick="showAndCount('checkboc')">2.5<br />
<input type="checkbox" name="checkboc" value="1.3" onclick="showAndCount('checkboc')">1.3<br />
<span>总数:<b id="bCount"></b></span></div>
</form>
<script>
//每次点击checkbox控件就会触发这个方法
function showAndCount(idx){
var chkVal=0;
var Val=0;
var sum=0;
var chks=eval("document.myform."+idx);//这一句的到所有name值为idx的checkbox控件。
//document.myform中的myform是你的form的name的值

for ( var i = 0; i < chks.length; i++){
chkVal= chks[i].checked ? 1 : 0;//选中值为1
Val=parseFloat(chks[i].value);//将对应checkbox的value值转成float型,因为有小数。
sum+=parseFloat(chkVal*Val);//累加和
}
document.getElementById("bCount").innerHTML = sum;
}
</script>
</body>

㈢ EXTJS 为下拉框赋值问题

EXTJS 下拉框 combobox 可以通过3种方式赋值
1定义时 用value:值
2.点击选项赋值
3.用setValue 或者 setRawValue 方法赋值
需要内注意的是容 setValue 或者 setRawValue 需要在对象 渲染后才能执行 否则或赋值失败
对于您的问题 要看代码 是否是在渲染后赋值 , 或者 在没有 setValue 时 是否正常

㈣ extjs中的ComboBox怎么动态赋值

xtype : 'combo',
emptyText : '请选择年份^',//下拉框初始显示字段
fieldLabel : '年份选择',
store : new Ext.data.Store( {
proxy : new Ext.data.HttpProxy( {
url : 'info/infoMovie!getAllInfo.do'//提交到某action的某方法
}),
reader : new Ext.data.JsonReader( {}, [ 'movieYear' ]),//需要显示的数据实体字段
autoLoad : true
}),
displayField : 'movieYear', //显示文本字段
hiddenName : 'infoMovie.movieYear',//真正提交此combo时的name
valueField : 'movieYear', //值字段
triggerAction : 'all', //设置为”all”,否则默认 为”query”的情况下,
//你选择某个值后,再此下拉时,只出现匹配选项,
//如果设为”all”的话,每次下拉均显示全部选项
editable : false,
allowBlank : false

}

㈤ extjs grid 中 如何根据数据动态给checkbox赋值

renderer:function(v){

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

CheckBox(复选框)主要用来接收用户选择的选项
如图所示(请忽略UI的不好看):
该弹出窗口的主要代码如下:
复制代码
代码如下:
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)
这两句话就是如何得到完整性和正确性的值。

㈦ Extjs怎样获取checkBox的值

{
2xtype:'fieldset',
3title:'兴趣',
4autoHeight:true,
5defaultType:'checkbox',
6hideLabels:true,
7id:'xq',
8layout:'hbox',
9defaults:{
10flex:1
11},
12//vertical:false,
13items:[
14{boxLabel:'游泳',name:'xqn',inputValue:'4',checked:true},
15{boxLabel:'玩儿',name:'xqn',inputValue:'5'},
16{boxLabel:'游戏',name:'xqn',inputValue:'6'}
17]


页面效果:

阅读全文

与extjs给checkbox赋值相关的资料

热点内容
cad文件为什么显示文件名是否正确 浏览:174
程序配置文件能自动转换成txt 浏览:985
r4烧录卡不同版本 浏览:962
怎么升级qq群为2000 浏览:347
微信己册除的文件怎样找回来 浏览:715
苹果美国账号共享2017 浏览:252
ps文件修改后打开还是原图 浏览:220
烧卡机苹果4微信qq哪里下载 浏览:780
ug120找不到指定文件 浏览:522
cda文件怎么转换成mp3格式 浏览:702
青岛hpv疫苗在哪个app预约 浏览:881
双十一成交额2021数据在哪里看 浏览:631
苹果手机怎么打开移动数据 浏览:637
文件扫描成图片是彩色的吗 浏览:50
编程里的comply什么意思 浏览:91
电脑上面点了禁用网络怎么改回来 浏览:28
javacatch执行 浏览:182
ps软件文件名字 浏览:184
黑苹果查找文件路径 浏览:397
现在编程都有哪些语言 浏览:360

友情链接