:::

4-1-3 套用BootstrapTable強化表格

您沒有觀看影片的權限

您沒有觀看影片的權限

請先登入,登入後,確認您的權限後,即可觀看影片。

  1. BootstrapTable 是TadTools提供的套件之一,可以強化表單功能,例如可以做欄位排序或搜尋表格中資料,詳情可參考:https://www.tad0616.net/modules/tad_book3/page.php?tbsn=15&tbdsn=1717
  2. 修改 class\Tad_signup_actions.php 在最前面加入
    use XoopsModules\Tadtools\BootstrapTable;

     

  3. 一樣修改 class\Tad_signup_actions.php 中的 show()
    //以流水號秀出某筆資料內容
    public static function show($id = '')
    {
        global $xoopsDB, $xoopsTpl;
    
        /*--- 略---*/
    
        $signup = Tad_signup_data::get_all($id, true);
        $xoopsTpl->assign('signup', $signup);
    
        BootstrapTable::render();
    }

     

  4. 最後修改 templates\op_tad_signup_actions_show.tpl,在表格上加入一些屬性即可。
    <table data-toggle="table" data-pagination="true" data-search="true" data-mobile-responsive="true">
        <thead>
            <tr>
                <{foreach from=$signup.0.tdc key=col_name item=user name=tdc}>
                    <th data-sortable="true"><{$col_name}></th>
                <{/foreach}>
                <th data-sortable="true">報名日期</th>
            </tr>
        </thead>
        <!-- 略 -->
    </table>

     

link to https://github.com/tadlearn/tad_signup/commit/https://github.com/tadlearn/tad_signup/commit/ccaf04832f9b6fcebb575898441bc94fe0ae667c \


:::

搜尋

QR Code 區塊

https%3A%2F%2Fwww.tad0616.net%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbsn%3D48%26tbdsn%3D1680

書籍目錄

展開 | 闔起

線上使用者

126人線上 (8人在瀏覽線上書籍)

會員: 0

訪客: 126

更多…