js相关:BootStrap给table表格的每一行添加一个按钮事件
发布于 2020-5-28|
复制链接
摘记: 1.在列属性中加入事件
```java
{
title:'数据量序号',
field:'sjid'
// hidden:true
},{
field: 'operate',
title: '操作 ..
1.在列属性中加入事件
```java
{
title:'数据量序号',
field:'sjid'
// hidden:true
},{
field: 'operate',
title: '操作',
width: '80px',
events: operateEvents,
formatter: operateFormatter
}
```
2.写一个函数
```java
function operateFormatter(value, row, index) {
return [
'',
].join('');
}
```
3.记得这个写在表格的前面
```java
window.operateEvents = {
'click .RoleOfedit': function (e, value, row, index) {
alert(row.qxxh);
$("#upload").modal('show');
}
};
```
4.点击“弹出模态框”
```java
×
上传文件
关闭
```