BootStrap给table表格的每一行添加一个按钮事件
作者:xingxuexue 时间:2024-05-11 09:07:33
1.在列属性中加入事件
{
title:'数据量序号',
field:'sjid'
// hidden:true
},{
field: 'operate',
title: '操作',
width: '80px',
events: operateEvents,
formatter: operateFormatter
}
2.写一个函数
function operateFormatter(value, row, index) {
return [
'<input type="submit" value="上传" class="RoleOfedit btn btn-primary btn-sm" data-toggle="modal" style="display:inline">',
].join('');
}
3.记得这个写在表格的前面
window.operateEvents = {
'click .RoleOfedit': function (e, value, row, index) {
alert(row.qxxh);
$("#upload").modal('show');
}
};
4.点击“弹出模态框”
<div class="modal fade" id="upload" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<form action="http://localhost:8080/GD/UploadAction_execute.action" method="post" enctype="multipart/form-data" name="uploadfile">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabelfile">上传文件</h4>
</div>
<div class="modal-body">
<input type="file" name="my" id="file" value="浏览" style="display: none;"
onchange="document.uploadfile.filePath.value=this.value"/>
<input type="text" name="filePath" id="filePath"/>
<input type="button" value="浏览..." onclick="document.uploadfile.my.click()"/><br>
<input type="submit" value="上传" id="shangchuan">
</div>
<div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal -->
</form>
</div>
总结
以上所述是小编给大家介绍的BootStrap给table表格的每一行添加一个按钮事件网站的支持!
来源:http://blog.csdn.net/xingxuexue/article/details/77878239
标签:bootstrap,表格,按钮
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
PyTorch device与cuda.device用法介绍
2022-07-26 23:49:10
python使用协程实现并发操作的方法详解
2021-09-24 11:23:10
tensorflow基于Anaconda环境搭建的方法步骤
2022-11-04 10:12:58
python实现批量文件重命名
2021-03-25 22:04:38
![](https://img.aspxhome.com/file/2023/5/79585_0s.jpg)
解决Jupyter NoteBook输出的图表太小看不清问题
2023-09-07 16:00:21
使用jupyter notebook运行python和R的步骤
2023-03-30 18:22:50
![](https://img.aspxhome.com/file/2023/0/80410_0s.png)
Django使用Channels实现WebSocket的方法
2023-12-10 16:20:05
![](https://img.aspxhome.com/file/2023/2/102902_0s.jpg)
基于php无限分类的深入理解
2023-11-15 04:07:39
Python中PyMySQL的基本操作
2024-01-15 20:57:11
Vue配置文件vue.config.js配置前端代理方式
2023-07-02 16:39:06
Go语言参数传递是传值还是传引用
2024-02-20 02:32:34
![](https://img.aspxhome.com/file/2023/0/105120_0s.png)
将后台数据从Berkeley的文件DB转到MySQL
2009-01-04 13:31:00
Linux中大内存页Oracle数据库优化的方法
2023-07-19 11:24:57
![](https://img.aspxhome.com/file/2023/6/64436_0s.jpg)
解决Mac下使用python的坑
2021-02-26 21:47:38
python实现Decorator模式实例代码
2022-05-10 06:04:56
Django中Forms的使用代码解析
2022-03-20 08:06:56
![](https://img.aspxhome.com/file/2023/9/84079_0s.png)
如何利用opencv训练自己的模型实现特定物体的识别
2022-06-19 02:05:39
![](https://img.aspxhome.com/file/2023/0/131290_0s.jpg)
Python图像处理之图像金字塔的向上和向下取样
2021-12-19 03:56:06
![](https://img.aspxhome.com/file/2023/3/91953_0s.jpg)
快速了解Python相对导入
2023-07-29 18:35:30
详解js前端代码异常监控
2024-04-22 13:06:26
![](https://img.aspxhome.com/file/2023/0/135800_0s.png)