如何将dataIndex绑定到全选复选框 [英] How to Bind dataIndex to Select All check box
本文介绍了如何将dataIndex绑定到全选复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
xtype: 'grid',
store:{
type:'webapi',
api:{
read:'api / Report / GetIfo'
},
autoLoad:true,
},
列:[
{header:'Name',dataIndex:'first_name'}
],
selModel:{
selType:'checkboxmodel',
// dataIndex:'flag',
// showHeaderCheckbox:true
}
我试图将dataIndex绑定到它,以便在加载网格时,将选择相应的复选框。
我尝试使用
selModel:{
selType:'checkboxmodel',
// dataIndex:'flag',
// showHeaderCheckbox:true
}
但没有成功。请给我建议我如何绑定dataIndex这里。
解决方案
我的建议是使用 https://docs.sencha.com/extjs/5.0/ 5.0.1-apidocs /#!/ api / Ext.grid.column.Check
如果不是,标志必须为true或false,则应转换为您的模型如
{name:'flag',键入:'bool',
convert:function(v) {
return(v ===True|| v === true)?真假;
}
}
I am trying to bind checkbox field to gird with select all options -
xtype: 'grid', store: { type: 'webapi', api: { read: 'api/Report/GetIfo' }, autoLoad: true, }, columns: [ { header: 'Name', dataIndex: 'first_name'} ], selModel: { selType: 'checkboxmodel', //dataIndex:'flag', //showHeaderCheckbox: true }
I am trying to bind the dataIndex to it so that when grid is loaded, respective checkbox will be selected.
I tried by using
selModel: { selType: 'checkboxmodel', //dataIndex:'flag', //showHeaderCheckbox: true }
But no success. Please suggest me on how to bind the dataIndex here.
解决方案
My suggestion to you is use https://docs.sencha.com/extjs/5.0/5.0.1-apidocs/#!/api/Ext.grid.column.Check
Flag have to true or false if not, you should convert in your model like
{ name: 'flag', type: 'bool',
convert: function (v) {
return (v === "True" || v === true) ? true : false;
}
}
这篇关于如何将dataIndex绑定到全选复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文