angularjsng-gridcelltemplate

ng-grid cellTemplate issue with background color of cell


When I have a value as an empty string "" in the data and I use background color in cellTemplate it does not color enitire cell. Here is the plunke that illustrates the issue.

http://plnkr.co/edit/TP4VH9xA7qCFT8xgNKW8?p=preview

Can someone help me fix it.


Solution

  • I found a workaround, in cellTemplate you can check for an empty/null string and add the HTML &nbsp (non breaking space) entity, this way your cell will be properly rendered.

    Example:

    cellTemplate: '<div class="yellow" ><div class="ngCellText">{{row.getProperty(col.field)||"&nbsp"}}</div></div>'
    

    Changed your plunker, here's a working example : http://plnkr.co/edit/tR6UKCrXZqKi5HwsWOAV?p=preview