修改 bootstrap table 默認detailRow樣式的實例代碼
更新時間:2017年07月21日 08:48:27 作者:Wilfredo_Ho
這篇文章主要介紹了修改 bootstrap table 默認detailRow樣式的實例代碼,非常不錯,具有參考借鑒價值,需要的朋友可以參考下
廢話不多說了,直接給大家貼代碼,具體代碼如下所示:
this.$body.find('> tr[data-index] > td > .detail-icon').off('click').on('click', function () { var $this = $(this), //a.detail-icon $tr = $this.parent().parent(), //current row index = $tr.data('index'), row = data[index]; // Fix #980 Detail view, when searching, returns wrong row // remove and update if ($tr.next().is('tr.detail-view')) { //exsit $this.find('i').attr('class', sprintf('%s %s', that.options.iconsPrefix, that.options.icons.detailOpen)); that.trigger('collapse-row', index, row); $tr.next().remove(); $tr.next().remove(); } else { //not exsit and add $this.find('i').attr('class', sprintf('%s %s', that.options.iconsPrefix, that.options.icons.detailClose)); //$tr.after(sprintf('<tr class="detail-view"><td colspan="%s"></td></tr>', $tr.find('td').length)); $tr.after(sprintf('<tr class="detail-view detail-view-head"></tr>')); $tr.after(sprintf('<tr class="detail-view detail-view-body"></tr>')); var $element1 = $tr.next(); var $element2 = $element1.next(); //var $ //var $element = $tr.next().find('td'); var content = calculateObjectValue(that.options, that.options.detailFormatter, [index, row, $element1, $element2], ''); //console.log(content); //head , body Object if($element1.length === 1) { $element1.append(content.head); $element2.append(content.body); } that.trigger('expand-row', index, row, $element1, $element2); } that.resetView(); return false; });
以上所述是小編給大家介紹的修改 bootstrap table 默認detailRow樣式的實例代碼,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
相關(guān)文章
BootStrap 下拉菜單點擊之后不會出現(xiàn)下拉菜單(下拉菜單不彈出)的解決方案
最近學到Bootstrap下拉菜單,學懂了教程內(nèi)容之后自己敲一個點擊按鈕底下彈出下拉菜單的小demo,寫完代碼發(fā)現(xiàn)運行之后點擊按鈕沒反應(yīng),下拉菜單彈不出來,下面給大家分享下解決方案2016-12-12JS正則RegExp.test()使用注意事項(不具有重復(fù)性)
這篇文章主要介紹了JS正則RegExp.test()使用注意事項,結(jié)合實例形式分析了RegExp.test()方法的功能與用法,以及針對不能重復(fù)調(diào)用的解決方法,需要的朋友可以參考下2016-12-12回車直接實現(xiàn)點擊某按鈕的效果即觸發(fā)單擊事件
這篇文章主要介紹了回車直接實現(xiàn)點擊某按鈕的效果即觸發(fā)單擊事件,需要的朋友可以參考下2014-02-02