Search code examples
slickgrid

Dynamic cell height in slickgrid?


I have to display cell content like Policy Part Cert Separated with next line character In slickgrid table and so on. How can I do this? I searched but nothing worked for me. What should I do with this is there any way to fit contents by height.

I Have this code written for breaking cells

columnname: <p>+policy+</p><br/>+part......and so on.

Any lead will be highly appreciated.


Solution

  • Better register a new formatter for your column.

    Example

     function myformatter(row, cell, value, columnDef, dataContext) {
           return "<style='text-decoration: underline;color: #669900;height:120px;'>" + value +";
        }
    

    And call myformatter into column definition

    var columns = [];
        columns[0] = { id: "id", name: "columnname", field: "id", sortable: true, width: 5, formatter: myformatter };