开发者

jQuery's tabletogrid example

开发者 https://www.devze.com 2023-01-30 11:31 出处:网络
I have a HTML table and I would like to change the table to grid using jQuery\'s JQGrid plugin. How would i do that?

I have a HTML table and I would like to change the table to grid using jQuery's JQGrid plugin.

How would i do that?

Here is my HTML:

    <HTML>
<head>
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="jquery.jqGrid.min.js"></script>

<script type="text/javascript">
$(document).ready(function(){      
tableToGrid("#distTable"); 
});
</script> 

</head>
<body>
<table id="distTable">
<thead>
<tr> 
        <th>Name</th>
        <th>Platform</th>
        <th>Size</th>       
</tr>
</thead>
<tbody>
                    <tr>
                        <td align="center">102803</td>
                        <td align="center">102803d22222222222222222222222222222222222222gs</td>
                        <td align="center">21587231</td>
                    </tr>

            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align开发者_StackOverflow="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>

            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">102803</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
            <tr>
                <td align="center">10280311111111111111111111111</td>
                <td align="center">102803dgs</td>
                <td align="center">215872321</td>
            </tr>
</tbody>
</table>
</body>
</html>

Where and how I would be adding the jQuery script?


Try some thing like this.....
in HTML..........

<table id="distTable" border="2px" padding="7px 7px 7px 7px" border-style=" solid" >  

and in your code should be...

jQuery(document).ready(function(){

         ("#distTable").tableToGrid();

      });
0

精彩评论

暂无评论...
验证码 换一张
取 消