用法与CheckboxSelectionModel相同
Ext.ns('Ext.ux.grid');
Ext.ux.grid.RadioSelectionModel = function(config) {
Ext.ux.grid.RadioSelectionModel.superclass.constructor.call(this, config);
this.renderer = function(v, p, record){
var checked = record === this.selections.get(0);
var retval = '<div class="x-grid3-row-radio"><input type="radio" name="' + this.id + '"'+ (checked ? 'checked="checked"' : '')+ '></div>';
return retval;
}.createDelegate(this);
};
Ext.extend(Ext.ux.grid.RadioSelectionModel, Ext.grid.RowSelectionModel, {
header: '<div> </div>',
width: 20,
sortable: false,
fixed: true,
dataIndex: '',
id: 'radio',
singleSelect: true,
selectRow: function(index) {
Ext.ux.grid.RadioSelectionModel.superclass.selectRow.apply(this, arguments);
var row = Ext.fly(this.grid.view.getRow(index));
if(row) {
row.child('input[type=radio]').dom.checked = true;
}
}
});
本文介绍了一个Ext.ux.grid下的RadioSelectionModel组件,该组件继承自RowSelectionModel,并使用单选按钮进行选择操作。文章详细解释了其构造函数、属性设置及行选择方法。
5469

被折叠的 条评论
为什么被折叠?



