Jsgrid Javascript Grid Framework

addgrid method

The method addgrid creates a grid cell in the position where the grid was removed or not created before. The position status can be identified with the method grid. If a grid exists in the position, there will be no grid cell created.

Syntax

objgrid.addgrid(array element)

Parameters

element - A two element array [colno,rowno], in which colno means column number and rowno means row number.

Example

var pggrid = new jsgrid(); 
        pggrid.init({ 
        id:"wrp", 
        rows:5, 
        columns:12, 
        width:25, 
        height:20, 
        gutter:1,
        backgroundColor: "#7fffd4" 
        });
      
    pggrid.removegrids([2,0],[2,4]); 
    pggrid.removegrids([3,0],[3,3]); 
    pggrid.removegrids([4,2],[4,4]); 
    pggrid.removegrids([5,2],[5,3]);
     
    pggrid.addgrid([2,3]);
    pggrid.addgrid([3,2]);
    pggrid.addgrid([4,3]);
    pggrid.addgrid([5,3]);
         
    var grp2 = pggrid.grid([2,3]); 
    grp2.innerHTML = "2,3";

    var grp3 = pggrid.grid([3,2]); 
    grp3.innerHTML = "3,2";

    var grp4 = pggrid.grid([4,3]);
    grp4.innerHTML = "4,3";
     
    var grp5 = pggrid.grid([5,3]); 
    grp5.innerHTML = "5,3";

    pggrid.addstyle([grp2,grp3,grp4,grp5],{background:"#dc0"}); 

Grid View