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ì)大家有所幫助,如果大家有任何疑問(wèn)請(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)保存密碼功能,還可以通過(guò)cookie保存最近瀏覽記錄增加用戶體驗(yàn)。本文給大家介紹js使用cookie實(shí)現(xiàn)記住密碼功能及cookie相關(guān)函數(shù)講解,感興趣的朋友一起看看吧2016-11-11uniapp中安裝axios并解決跨域問(wèn)題小結(jié)
跨域(Cross-Origin)是指在瀏覽器中,當(dāng)前網(wǎng)頁(yè)的協(xié)議、域名或端口與請(qǐng)求目標(biāo)的協(xié)議、域名或端口不相同,即存在跨域請(qǐng)求的情況,這篇文章主要介紹了uniapp中安裝axios并解決跨域問(wèn)題小結(jié),需要的朋友可以參考下2024-05-05IE8利用自帶的setCapture和releaseCapture解決iframe的拖拽事件方法
最近有個(gè)需求須要實(shí)現(xiàn)左右拖拽功能,頁(yè)面右邊是個(gè)iframe頁(yè)面,在chrome測(cè)試通過(guò)之后,發(fā)現(xiàn)在ie8上面效果不是很理想,查閱相關(guān)資料找到可以使用ie自帶的setCapture和releaseCapture來(lái)解決,需要的朋友可以參考下2016-10-10javascript實(shí)現(xiàn)二叉樹(shù)的代碼
本篇文章主要介紹了javascript實(shí)現(xiàn)二叉樹(shù)的代碼,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2017-06-06解決layui追加或者動(dòng)態(tài)修改的表單元素“沒(méi)效果”的問(wèn)題
今天小編就為大家分享一篇解決layui追加或者動(dòng)態(tài)修改的表單元素“沒(méi)效果”的問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2019-09-09