Adding dynamic classes on grid Angular 2

Posted by: nilesh_nichal on 14 September 2017, 12:07 pm EST

    • Post Options:
    • Link

    Posted 14 September 2017, 12:07 pm EST

    I need to add different style classes in different scenario in wijimo grid. and need to change width of column.

    In our case grid is generated dynamically. Can you suggest way to add dynamic classes?

    Thanks

  • Posted 14 September 2017, 12:07 pm EST

    Hello Nilesh,

    You can add class dynamically as follows:

    If you would like to add class for Cell, you need to add class using itemFormatter’s cell property. Please use the following code snippet for the same:

    grid.itemFormatter=function(panel,r,c,cell){
       if(wijmo.grid.CellType.Cell==panel.cellType && r=2 && c==2){
            // add class here using cell that is a HTML element
       }
    }

    If you would like to add class for a row/column, you can add class using cssClass property of Row/Column class. Please use the following code snippet for the same:

    grid.rows[rowIndex].cssClass='classname';
    grid.columns[colIndex].cssClass='classname';

    Please add classes for row and columns in the initialzied or loadedRows event.

    You can change any column width using width property of Column class. Please use the following code snippet for the same:

    grid.columns[colIndex].width= 150; //width of column should be in number


    This code snippet should be in intialization/ loadedRows event if you would like above styling on FlexGrid first time loading.

    Thanks,

    Manish Kumar Gupta

  • Posted 12 December 2017, 3:42 am EST

    Can we make the width dynamic. I dont want it to be fixed

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels