您好,这个单元格的样式需要您自己绘制,以下代码演示了如何设置背景色为黄色:
- MyCellType.prototype.paint = function (ctx, value, x, y, w, h, style, options) {
- //Paints a cell on the canvas.
- if (!ctx) {
- return;
- }
- ctx.save();
- ctx.beginPath();
- ctx.moveTo(x,y);
- ctx.fillStyle = "yellow";
- ctx.fillRect(x,y,w,h);
- ctx.restore();
- var text = value ? value.split(",") : ["",""];
- ctx.fillText(text[0].trim() ,x + w *7/8, y + h/3);
- ctx.fillText(text[1].trim(),x + w /2, y + h*3/4);
- ctx.lineTo(x+w,y+h);
- ctx.stroke();
- ctx.font = style.font;
- ctx.restore();
- };
复制代码 |