Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Extjs 如何根据Sencha ExtReact中网格的行数据更改行背景色?_Extjs_Grid - Fatal编程技术网

Extjs 如何根据Sencha ExtReact中网格的行数据更改行背景色?

Extjs 如何根据Sencha ExtReact中网格的行数据更改行背景色?,extjs,grid,Extjs,Grid,我想根据ExtReact网格中的行数据更改行背景,在文档中找不到任何选项,我想您正在寻找。您必须重写getAdditionalData方法并返回包含rowBodyCls的对象 Ext.create('Ext.grid.Panel', { ... features: [{ ftype: 'rowbody', getAdditionalData: function (data, idx, record, orig) { // Use the data/reco

我想根据ExtReact网格中的行数据更改行背景,在文档中找不到任何选项,我想您正在寻找。您必须重写
getAdditionalData
方法并返回包含
rowBodyCls
的对象

Ext.create('Ext.grid.Panel', {
  ...
  features: [{
    ftype: 'rowbody',
    getAdditionalData: function (data, idx, record, orig) {
        // Use the data/record to determine which class to apply, then
        // style the row body in CSS.
        return {
            rowBodyCls: "my-body-class"
        };
    }
  }],
...

使用
grid.addRowCls(rowIndex,'red')使用此选项谢谢您的回复,但我无法使用此解决方案。我不想在渲染后更改行背景,我想在渲染行时设置一些CSS类或背景样式。实际上,记录有四种状态,根据状态,我希望这些行被着色。在ExtJS4中,我们可以使用viewConfig:{getRowClass:function(record,index,rowParams){//Set CSS-based-of-data}来实现这一点,但在ExtReact 6.5.1或Extjs 6.5.1 Hanks-Joe Holloway中我找不到类似的东西。这个解决方案适用于Extjs,但我一直在寻找ExtreatDoh的相同解决方案,我认为应该是相同的。如果有人在寻找ExtJS解决方案,我会留下这个。我翻遍了ExtReact文档,似乎有一些未记录的东西与我在这里提出的类似,但我无法准确指出如何实现它。谢谢你的帮助