午夜国产狂喷潮在线观看|国产AⅤ精品一区二区久久|中文字幕AV中文字幕|国产看片高清在线

    jQuery表格插件datatables用法總結(jié)
    來(lái)源:易賢網(wǎng) 閱讀:3360 次 日期:2014-09-07 11:53:26
    溫馨提示:易賢網(wǎng)小編為您整理了“jQuery表格插件datatables用法總結(jié)”,方便廣大網(wǎng)友查閱!

    易賢網(wǎng)網(wǎng)校上線了!

    >>>點(diǎn)擊進(jìn)入<<<

    網(wǎng)校開(kāi)發(fā)及擁有的課件范圍涉及公務(wù)員、財(cái)會(huì)類、外語(yǔ)類、外貿(mào)類、學(xué)歷類、

    職業(yè)資格類、計(jì)算機(jī)類、建筑工程類、等9大類考試的在線網(wǎng)絡(luò)培訓(xùn)輔導(dǎo)。

    其主要特點(diǎn)如下:

    1.自動(dòng)分頁(yè)處理

    2.即時(shí)表格數(shù)據(jù)過(guò)濾

    3.數(shù)據(jù)排序以及數(shù)據(jù)類型自動(dòng)檢測(cè)

    4.自動(dòng)處理列寬度

    5.可通過(guò)CSS定制樣式

    6.支持隱藏列

    7.易用

    8.可擴(kuò)展性和靈活性

    9.國(guó)際化

    10.動(dòng)態(tài)創(chuàng)建表格

    11.免費(fèi)的

    使用方法:

    <title>DataTables example</title>

    <style type="text/css" title="currentStyle">

    @import "../../media/css/demo_page.css";

    @import "../../media/css/demo_table.css";

    @import "../examples_support/themes/smoothness/jquery-ui-1.7.2.custom.css";

    </style>

    <script type="text/javascript" language="javascript" src="../../media/js/jquery.js"></script>

    <script type="text/javascript" language="javascript" src="../../media/js/jquery.dataTables.js"></script>

    <script type="text/javascript" charset="utf-8">

    上述代碼中引入js和css文件??梢栽赿emo里復(fù)制。注意路徑地址。

    <script type="text/javascript" charset="utf-8">

    $(document).ready(function() {

    $('#example').dataTable( {

    "oLanguage": {

    "sUrl": "/SSS/dataTables/de_DE.txt"

    },

    "bStateSave": true,

    //"bJQueryUI": true,  //使用jqueryui 。我用的時(shí)候顯示的不是很好

    "sPaginationType": "full_numbers"http://分頁(yè)

    } );

    } );

    </script>

    </head>

    <body id="dt_example">//此處為body的id

    <div id="container" align="center">//*div 里是 table ,table包括thead等,最好按此格式寫(xiě)*

    <h1>物品種類管理</h1>

    <div id="demo">

    <table cellpadding="5" cellspacing="0" border="1" class="display" id="example" align="center">//id 別忘了

    <thead>

    <tr>

    <th>物品編號(hào)</th>

    <th>物品名稱</th>

    <th>物品單位</th>

    <th>編輯狀態(tài)</th>

    <th>隨便</th>

    </tr>

    </thead>

    <tr class="gradeX">//此處可以是gradeA ,gradeX 等,但是gradeB 隔行換色 效果很好

    <td>Trident</td>

    <td>Internet

    Explorer 4.0</td>

    <td>Win 95+</td>

    <td class="center">4</td>

    <td class="center">X</td>

    </tr>

    <tr class="gradeC">

    <td>Trident</td>

    <td>Internet

    Explorer 5.0</td>

    <td>Win 95+</td>

    <td class="center">5</td>

    <td class="center">C</td>

    </tr>

    <tr class="gradeA">

    <td>Trident</td>

    <td>Internet

    Explorer 5.5</td>

    <td>Win 95+</td>

    <td class="center">5.5</td>

    <td class="center">A</td>

    </tr>

    </tbody>

    <tfoot>

    </tfoot> 

    </table>

    </div>   

    </div>

    上面就能創(chuàng)建出如圖的效果, 分頁(yè)。排序。等等。

    最后講講 各各屬性(主要添加的位置)

     

    //$(document).ready(function() {

      //$('#example').dataTable( {//加載

        //"bPaginate": true,//分頁(yè)按鈕

        //"bLengthChange": true,//每行顯示記錄數(shù)

        //"bFilter": true,//搜索欄

        //"bSort": true,//排序

        //"bInfo": true,//Showing 1 to 10 of 23 entries 總記錄數(shù)沒(méi)也顯示多少等信息

        //"bAutoWidth": true } );

    //} );

    //$(document).ready(function() {

      //$('#example').dataTable( {

        //"aaSorting": [[ 4, "desc" ]]//給列表排序 ,第一個(gè)參數(shù)表示數(shù)組 。4 就是css grade那列。第二個(gè)參數(shù)為 desc或是asc

      //} );

    //} );

    //$(document).ready(function() {

      //$('#example').dataTable( {

        //"aoColumns": [

        //  /* Engine */  null, //默認(rèn)

        //  /* Browser */ null,

        //  /* Platform */ { "bSearchable": false, //不可參與搜索

        //           "bVisible":  false },//不可見(jiàn)

        //  /* Version */ { "bVisible":  false },//不可見(jiàn)

        //  /* Grade */  null

        //] } );

    //} );

    //$(document).ready(function() {

      //$('#example').dataTable({

      //});

    //} );

    //$(document).ready(function() {

      //$('#example').dataTable( {

        //"sDom": '<"top"i>rt<"bottom"flp<"clear">'//這段是自定義布局沒(méi)搞明白挺復(fù)雜的。  * l - Length changing * f - Filtering input* t - The table!* i - Information* p - Pagination* r - pRocessing* < and > - div elements* <"class" and > - div with a class  * Examples: <"wrapper"flipt>, <lf<t>ip>

      //} );

    //} );

    //$(document).ready(function() {

    //  $('#example').dataTable( {

      //  "bStateSave": true //保存狀態(tài)到cookie *************** 很重要 , 當(dāng)搜索的時(shí)候頁(yè)面一刷新會(huì)導(dǎo)致搜索的消失。使用這個(gè)屬性就可避免了

      //} );

    //} );

    //$(document).ready(function() {

      //$('#example').dataTable( {

        //"sPaginationType": "full_numbers" //分頁(yè),一共兩種樣式 另一種為two_button 是datatables默認(rèn)

      //} );

    //} );

    //$(document).ready(function() {

      //$('#example').dataTable( { //分頁(yè)信息 不是很難理解。

        //"oLanguage": {

          //"sLengthMenu": "Display _MENU_ records per page",

          //"sZeroRecords": "Nothing found - sorry",

          //"sInfo": "Showing _START_ to _END_ of _TOTAL_ records",

          //"sInfoEmtpy": "Showing 0 to 0 of 0 records",

          //"sInfoFiltered": "(filtered from _MAX_ total records)"

        //}

      //} );

    //} )

    $(document).ready(function() {

      oTable = $('#example').dataTable({

        "bJQueryUI": true, //可以添加 jqury的ui theme 需要添加css

        "sPaginationType": "full_numbers"

      });

    } );

    默認(rèn)的語(yǔ)言是英文的 當(dāng)然可以國(guó)際化:

    "sUrl": "/SSS/dataTables/de_DE.txt" 添加個(gè)國(guó)際化的文件就可以。 名字隨便 路徑對(duì)了就可以。我寫(xiě)的國(guó)際化文件內(nèi)容如下,可以直接復(fù)制到txt中使用.

    {

    "sProcessing": "Bitte warten...",

    "sLengthMenu": "顯示_MENU_條 ",

    "sZeroRecords": "沒(méi)有您要搜索的內(nèi)容",

    "sInfo": "從_START_ 到 _END_ 條記錄——總記錄數(shù)為 _TOTAL_ 條",

    "sInfoEmpty": "記錄數(shù)為0",

    "sInfoFiltered": "(全部記錄數(shù) _MAX_ 條)",

    "sInfoPostFix": "",

    "sSearch": "搜索",

    "sUrl": "",

    "oPaginate": {

    "sFirst":  "第一頁(yè)",

    "sPrevious": " 上一頁(yè) ",

    "sNext":   " 下一頁(yè) ",

    "sLast":   " 最后一頁(yè) "

    }

    }

    更多信息請(qǐng)查看IT技術(shù)專欄

    更多信息請(qǐng)查看網(wǎng)絡(luò)編程
    易賢網(wǎng)手機(jī)網(wǎng)站地址:jQuery表格插件datatables用法總結(jié)
    由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請(qǐng)考生以權(quán)威部門(mén)公布的正式信息和咨詢?yōu)闇?zhǔn)!

    2025國(guó)考·省考課程試聽(tīng)報(bào)名

    • 報(bào)班類型
    • 姓名
    • 手機(jī)號(hào)
    • 驗(yàn)證碼
    關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡(jiǎn)要咨詢 | 簡(jiǎn)要咨詢須知 | 新媒體/短視頻平臺(tái) | 手機(jī)站點(diǎn) | 投訴建議
    工業(yè)和信息化部備案號(hào):滇ICP備2023014141號(hào)-1 云南省教育廳備案號(hào):云教ICP備0901021 滇公網(wǎng)安備53010202001879號(hào) 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號(hào)
    云南網(wǎng)警備案專用圖標(biāo)
    聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號(hào):hfpxwx
    咨詢QQ:1093837350(9:00—18:00)版權(quán)所有:易賢網(wǎng)
    云南網(wǎng)警報(bào)警專用圖標(biāo)