導航:首頁 > 編程語言 > extjscheckbox選中

extjscheckbox選中

發布時間:2023-03-09 07:55:31

㈠ 怎麼獲得Extjs表格選中的值

你看這樣行么
var sm = new Ext.grid.CheckboxSelectionModel(); //選擇模型,定義checkbox選擇框,可選項
在做一個按鈕
tbar:{
text:'修改',
tooltip:'修改菜單',
iconCls:'viewButton',
handler:modfiy,
disabled:false
},
在寫一個modfiy事件
這里的.getSelectionModel().hasSelection()就是獲取值了
function modfiy(){
if (grid.getSelectionModel().hasSelection()){
var records=grid.getSelectionModel().getSelections();

if(records.length == 1){
var id=records[0].data['id'];
top.ExtModalDialog.show(
"修改菜單",
"sys/menuhandle.servlet?action=modfiy&id="+id,
null,
refresh,
{width:500,height:400}
);
}else{
top.Ext.Msg.alert('提示','請選中一條修改!');
}
}else{
top.Ext.Msg.alert('提示','請選中要操作的記錄!');
}
};
表的ID是gride

我試了試可以

㈡ extjs 復選框價格累加

累加的時候,你需要做下判斷,就是你選中的這個checkbox必須四海勾選狀態才累加,否則則減去這個價格
if(checks[rowIndex].checked==true){
var tempzongjia=zongjia+price;
}else{
var tempzongjia=zongjia-price;
}

我覺得你這塊代碼出了問題,你可以再這塊用alert測試,或者firebug調試,都可以

㈢ extjs 根據fieldset的checkBox情況,來全選checkBoxGroup

<!doctypehtml>
<htmllang="en">
<head>
<metacharset="UTF-8">
<title>Extjs4.2demo</title>
<linkrel="stylesheet"href="../resources/css/ext-all.css">
<scriptsrc="../bootstrap.js"></script>
<script>

.onReady(function(){

Ext.create('Ext.Panel',{

width:450,
items:[{
xtype:'checkboxgroup',
listeners:{

change:function(gp,nv,ov,eOpts){

//全選
if(nv.all&&!ov.all)
returngp.eachBox(function(box,idx){
box.setRawValue(true);
});

//反選
if(ov.all&&!nv.all)
returngp.eachBox(function(box,idx){
box.setRawValue(false);
});

}

},
width:'100%',
fieldLabel:'AutoLayout',
cls:'x-check-group-alt',
items:[
{boxLabel:'全選',name:'all'},
{boxLabel:'Item1',name:'cb-auto-1',checked:true},
{boxLabel:'Item2',name:'cb-auto-2'},
{boxLabel:'Item3',name:'cb-auto-3'},
{boxLabel:'Item4',name:'cb-auto-4'}
]
},{
xtype:'button',
text:'GetChecked',
handler:function(){

Ext.Msg.alert('選中數量',String(this.up('panel').items.items[0].getChecked().length));
}
}],
renderTo:Ext.getBody()

});
});

</script>
</head>
<body>

</body>
</html>

㈣ extjs4.2 怎麼根據name 獲取 checkboxgroup選中的值

varCheckboxGroup=form.getForm().findField('name');
for(vari=0;i<CheckboxGroup.items.length;i++)
{
if(CheckboxGroup.items.itemAt(i).checked)
{
alert(CheckboxGroup.items.itemAt(i).name);
}
}

㈤ extjs中checkcolumn怎麼默認勾選部分checkbox

查看它對應的dataIndex名、在grid的store載入值時傳個布爾值應該就行了

㈥ extjs 如何根據資料庫欄位讓CheckboxSelectionModel選中

store 為grid的store,數據載入完後判斷一下ID=3的數據在store中的位置,然後選中這一行

store.on('load',function(store, records){
var index = store.find('ID',3);
grid.getSelectionModel().selectRow(index);

});

㈦ extjs 如何單擊下讓GridPanel里某一行的復選框選中

var sm = new Ext.grid.CheckboxSelectionModel({
//singleSelect: true,
listeners:{
//選中
"rowselect": function (grid,rowIndex,e) {
//使用這種方法會在先點擊最後一組數據的時候報錯
//var row=grid.getSelections();
//var val=row[rowIndex].get("id");

var grid = Ext.getCmp("shopGrid");
var val = grid.getStore().getAt(rowIndex).get("id");
sendUsersId.push(val);//存放用戶id
//alert(sendUsersId.toString());
},
//取消選中
"rowdeselect": function (grid, rowIndex, e) {
var grid = Ext.getCmp("shopGrid");
var val=grid.getStore().getAt(rowIndex).get("id");
sendUsersId.remove(val);//移除用戶id
//alert(sendUsersId.toString());
}
}
});

㈧ extjs CheckboxGroup默認選中問題

Ext.onReady(function() {
var port = new Ext.Viewport({
layout: 'border',
items: [chkEditDomain],
cls: "inner-viewport",
listeners: {
render: function() {
// Ext.getCmp("itemsid0").setValue("211", true);
// Ext.getCmp("itemsid0").setValue("212", true);
// Ext.getCmp("itemsid0").setValue("213", true);
// Ext.getCmp("itemsid0").setValue("214", true);
}
}
});
});
var chkEditDomain = new Ext.form.CheckboxGroup({
xtype: 'checkboxgroup',
fieldLabel: '測試',
name: 'chkEditDomain',
allowBlank: false,
id: 'itemsid0',
width: 200,
columns: 4,
items: [
{ boxLabel: 'IND', name: 'IND', id: '211', inputValue: '5', checked:true },
{ boxLabel: 'CE', name: 'CE', id: '212', inputValue: '6' ,checked:true},
{ boxLabel: 'SC', name: 'SC', id: '213', inputValue: '8' ,checked:true},
{ boxLabel: 'FA', name: 'FA', id: '214', inputValue: '7' ,checked:true}
]
});

這樣行嗎?

閱讀全文

與extjscheckbox選中相關的資料

熱點內容
fgets空文件 瀏覽:857
傳奇物品文件夾 瀏覽:352
word插入excel圖表 瀏覽:690
xp系統搜索不到本地文件 瀏覽:39
什麼網站可以找到拼團去西藏 瀏覽:247
javatask 瀏覽:50
MFC的文件名 瀏覽:972
cad自動保存的文件怎麼關閉 瀏覽:667
zip文件密碼多少 瀏覽:486
編程培訓哪些好 瀏覽:324
如何把文件夾內容變成文檔 瀏覽:509
小火箭幼兒編程怎麼拿積分 瀏覽:158
火車票時刻表及票價資料庫 瀏覽:94
求平均值java 瀏覽:767
linux如何分屏顯示 瀏覽:257
手機可以直接填寫pdf文件么 瀏覽:554
linux虛擬光碟機軟體 瀏覽:836
米2s最好的版本 瀏覽:640
小米6檢測工具下載 瀏覽:540
桌面創建不了文件夾怎麼回事 瀏覽:894

友情鏈接