当前位置: 首页 > 工具软件 > jQuery Grid > 使用案例 >

jQuery Grid Plugin插件

司凡
2023-12-01

//脚本

<script>

$(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'],
                         
                            ];

                var obj = {};
                obj.width = 700;
                obj.height = 400;
                //声明表头
                obj.colModel = [{ title: "Rank", width: 100, dataType: "integer" },
                    { title: "Company", width: 200, dataType: "string" },
                    { title: "Revenues ($ millions)", width: 150, dataType: "float", align: "right" },
                    { title: "Profits ($ millions)", width: 150, dataType: "float", align: "right" }];
                //数据类型                
                 obj.dataModel = { data: data };
                //绑定数据
                $("#grid_array").pqGrid(obj);

            });

</script>

//页面

<div id="grid_array"></div>   --显示数据
官网:http://paramquery.com
进入里面的demos项里有详细学习。可以处理的数据格式:json,xml,Array;分页,查询,分组等。

 

 类似资料: