//行事件改为
that.layBody.on('mouseenter', 'tr', function(){ //鼠标移入行});这事件内容
}).on('click', 'tr', function(){ //单击行
setRowEvent.call(this, 'row');
})
that.layBody.on('mouseenter', 'tr', function(){ //鼠标移入行});这事件内容2、使用 table.render({});增加配置一项:,rowSelect:true
}).on('click', 'tr', function(){ //单击行
if(that.config.rowSelect){
var othis = $(this)
,thisData = table.cache[that.key]
,index = othis.index()
,tr=that.layBody.find('tr:eq('+ index +')')
,radio = tr.find('input[lay-type="layTableRadio"]')//.prev();;
radio.attr('checked','checked');
//radio.prop('checked',true);
that.renderForm('radio');
//重置数据单选属性
layui.each(thisData, function(i, item){
if(index === i){
item.LAY_CHECKED = true;
} else {
delete item.LAY_CHECKED;
}
});
that.setThisRowChecked(index);
setRowEvent.call(this, 'rowSelect');
}
else setRowEvent.call(this, 'row');
})
table.on('rowSelect(表格ID)',function(obj){获得选择数据还是不变的。
var rowdata=obj.data;
});
微信扫码关注 layui 公众号