首頁 >web前端 >js教程 >jQuery表格外掛ParamQuery簡單使用方法範例_jquery

jQuery表格外掛ParamQuery簡單使用方法範例_jquery

WBOY
WBOY原創
2016-05-16 17:10:351328瀏覽

jQuery表格外掛ParamQuery簡單使用方法範例_jquery

實作步驟:
先在html的head中加入jQuery和jQuery UI的引用:

複製程式碼 程式碼如下:


      
 


再加入對Param Query Grid的引用:

複製程式碼 程式碼如下:


程式碼如下:

程式碼如下:

               增加腳本程式碼:複製程式碼 程式碼如下:

$(function () {
                var data = [    [1, 'Exxon Mobil', '339,938.0', '36,130.0'],
                                [2, 'Wal-Mart Stores', '315,654.0', '11,231.0'],
                                [3, 'Royal Dutch Shell', '306,731.0', '25,311.0'],
                                [4, 'BP', '267,600.0', '22,341.0'],
                                [5, 'General Motors', '192,604.0', '-10,567.0'],
                                [6, 'Chevron', '189,481.0', '14,099.0'],
                                [7, 'DaimlerChrysler', '186,106.3', '3,536.3'],
                                [8, 'Toyota Motor', '185,805.0', '12,119.6'],
                                [9, 'Ford Motor', '177,210.0', '2,024.0'],
                                [10, 'ConocoPhillips', '166,683.0', '13,529.0'],
                                [11, 'General Electric', '157,153.0', '16,353.0'],
                                [12, 'Total', '152,360.7', '15,250.0'],
                                [13, 'ING Group', '138,235.3', '8,958.9'],
                                [14, 'Citigroup', '131,045.0', '24,589.0'],
                                [15, 'AXA', '129,839.2', '5,186.5'],
                                [16, 'Allianz', '121,406.0', '5,442.4'],
                                [17, 'Volkswagen', '118,376.6', '1,391.7'],
                                [18, 'Fortis', '112,351.4', '4,896.3'],
                                [19, 'Crédit Agricole', '110,764.6', '7,434.3'],
                                [20, 'American Intl. Group', '108,905.0', '10,477.0']
                            ];

                var obj = {};
                 obj.height = 400;
                obj.colModel = [{ title: "Rank", width: 100,eger 數據: " },
                    { title: "Company", width: 200, 資料類型: tle: "Revenues ($ millions)", width: 150, dataType: "float", align: "right" },
                    { title: "Profits ($ millions)", width: 150, dataType: "float", align: 150     obj.dataModel = { data: data };
                $("#grid_array").pqGrid(obj);

            });


最後,在要顯示的地方加入div元素,用來顯示表格:

複製程式碼 程式碼如下:
">


運行就能看到效果
加入Theme皮膚的Demo



實作步驟:jQuery表格外掛ParamQuery簡單使用方法範例_jqueryjs程式碼邏輯部分沒有任何變動,哈哈。

html的head部分增加那麼一句style引用,就搞定了,如下:



複製程式碼 程式碼如下:              



陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn