在SlickGrid中更改单元格的背景颜色时,缺少空间? [英] Missing space when I change the cell's background color in SlickGrid?

查看:316
本文介绍了在SlickGrid中更改单元格的背景颜色时,缺少空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用自定义格式化程序更改单元格的背景颜色,如下所示:

I was trying to change cell's background color with custom formatter like this:

var myCellFormatter = function(row, cell, value, columnDef, dataContext) {
    if ((row + cell) % 5 == 1) {
        return "<div style='background-color:green'>" + value + "</div>";
    } else {
        return value;
    }
};

但这不会对整个单元格着色。
单元格 div 和格式化程序中的 div 之间有一些空格。

but this does not color the whole cell. There is some space between cell's div and the div in the formatter.

如何着色整个单元格?

推荐答案

columnDefinition.cssClass =myCell),将单元格的填充设置为0px。

Add a CSS class to that column (columnDefinition.cssClass="myCell") that would set the padding of the cell to 0px.

这篇关于在SlickGrid中更改单元格的背景颜色时,缺少空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆