Extjs grid 的背景框颜色设置

这里写图片描述
有时候需要根据特定的条件改变grid某一行的背景色,所以就可以使用renderer方法

{
                                "text": "参考值",
                                flex: 1,
                                "dataIndex": "REFERENCE",
                                editor: {
                                    xtype: 'textfield',
                                },
                                'minWidth': 120,
                                renderer: function (v, f, record) {
                                //这里可以根据v或者record来获取不同的值进行条件判断,然后进行格式的改变。
                                 /* if (v === '0') {
                                        return '<a style="text-decoration: underline;color: blue;cursor:pointer">' + '临时保存' + '</a>';
                                  } else if (v === '1') {
                                        return '已提交';
                            }*/
                                        f.tdStyle = 'background-color:#ebef17a3';
                                    return v//一定要记得返回值否则就是空的数据。

                                }
                            },

猜你喜欢

转载自blog.csdn.net/ann_mi/article/details/80236397
今日推荐