Sample: dhtmlxGrid Initialization from HTML table dhtmlxGrid main page
X

Initialization from HTML table with script command

  • Convert table to grid
  • Column 1 Column 2
    value 11 value 12
    value 21 value 22
    value 31 value 32
    value 41 value 42
    value 51 value 52

     
        var mygrid = new dhtmlXGridFromTable('tblToGrid');

    Automatic initialization

    Column 2 Column 2
    value 11 value 12
    value 21 value 22
    value 31 value 32
    value 41 value 42
    value 51 value 52

  • Initialize automatically from table which class attribute set to "dhtmlxGrid"
  •  
        //required js file
        <script  src="js/dhtmlxgrid_start.js"></script>
        
        <!--- Table to convert --->
        <!--- Setting light mouse navigation --->
        <table class="dhtmlXGrid" imgpath="../../codebase/imgs/" style="width:400px" lightnavigation="true">
            <!--- First row treatted as grid header  --->
            <tr>
                <!--- First column can't be edited  --->
                <td type="ro">Column 1</td>
                <td>Column 2</td>
            </tr>
            <!--- All other rows - Grid body --->
            <tr>
                <td>value 11</td>
                <td>value 12</td>
            </tr>
            <tr>
                <td>value 21</td>
                <td>value 22</td>
            </tr>
            ...
        </table>