BootStrap給table表格的每一行添加一個(gè)按鈕事件
1.在列屬性中加入事件
{
title:'數(shù)據(jù)量序號(hào)',
field:'sjid'
// hidden:true
},{
field: 'operate',
title: '操作',
width: '80px',
events: operateEvents,
formatter: operateFormatter
}
2.寫一個(gè)函數(shù)
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.記得這個(gè)寫在表格的前面
window.operateEvents = {
'click .RoleOfedit': function (e, value, row, index) {
alert(row.qxxh);
$("#upload").modal('show');
}
};
4.點(diǎn)擊“彈出模態(tài)框”
<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">關(guān)閉</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal -->
</form>
</div>
總結(jié)
以上所述是小編給大家介紹的BootStrap給table表格的每一行添加一個(gè)按鈕事件,希望對(duì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
相關(guān)文章
JavaScript中如何使用cookie實(shí)現(xiàn)記住密碼功能及cookie相關(guān)函數(shù)介紹
cookie是網(wǎng)站設(shè)計(jì)者放置在客戶端(瀏覽器)的小文本文件,cookie不僅能夠?qū)崿F(xiàn)保存密碼功能,還可以通過cookie保存最近瀏覽記錄增加用戶體驗(yàn)。本文給大家介紹js使用cookie實(shí)現(xiàn)記住密碼功能及cookie相關(guān)函數(shù)講解,感興趣的朋友一起看看吧2016-11-11
IE8利用自帶的setCapture和releaseCapture解決iframe的拖拽事件方法
最近有個(gè)需求須要實(shí)現(xiàn)左右拖拽功能,頁(yè)面右邊是個(gè)iframe頁(yè)面,在chrome測(cè)試通過之后,發(fā)現(xiàn)在ie8上面效果不是很理想,查閱相關(guān)資料找到可以使用ie自帶的setCapture和releaseCapture來解決,需要的朋友可以參考下2016-10-10
解決layui追加或者動(dòng)態(tài)修改的表單元素“沒效果”的問題
今天小編就為大家分享一篇解決layui追加或者動(dòng)態(tài)修改的表單元素“沒效果”的問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2019-09-09

