Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/24.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
Reactjs 如何使用数据不一致的固定数据表_Reactjs_Fixed Data Table - Fatal编程技术网

Reactjs 如何使用数据不一致的固定数据表

Reactjs 如何使用数据不一致的固定数据表,reactjs,fixed-data-table,Reactjs,Fixed Data Table,这是我的报价,我想在我的固定数据表中显示它们。 如果报价是全球性的,则数据中没有条目 { "id" : "90528630948ijvehiddwid", "name" : "Some Offer In Germany", "updatedTime" : "2016-01-15T13:24:26.090Z", "createdTime" : "2016-01-15T09:37:12.396Z", "country" : { "code" : "DE", "na

这是我的报价,我想在我的固定数据表中显示它们。 如果报价是全球性的,则数据中没有条目

{
  "id" : "90528630948ijvehiddwid",
  "name" : "Some Offer In Germany",
  "updatedTime" : "2016-01-15T13:24:26.090Z",
  "createdTime" : "2016-01-15T09:37:12.396Z",
  "country" : {
    "code" : "DE",
    "name" : "Germany"
  }
},
{
  "id" : "589476350240ß358540a",
  "name" : "Some Global In Offer",
  "updatedTime" : "2016-01-15T13:24:26.090Z",
  "createdTime" : "2016-01-15T09:37:12.396Z"
}
我想有一个自定义单元格,如果没有可用的国家/地区,则显示“全局”。但我看到问题就在表中,因为如果没有条目,它就无法构建单元

var CountryCell = ({rowIndex, data, col, ...props}) => (
    <Cell {...props}>
      {col ? data[rowIndex][col] : 'Global' }
    </Cell>
);

<Column
            columnKey="country"
            header={<Cell>country</Cell>}
            footer={<Cell className='backgroud-blue'></Cell>}
            cell={<CountryCell data={this.state.offers} col="country"/>}
            fixed={false}
            width={250}
            isResizable={false}
          />
var CountryCell=({rowIndex,data,col,…props})=>(
{col?数据[rowIndex][col]:'Global'}
);

那么,对于这种情况,什么是最好的方法呢。我是否要围绕我的原始数据构建一个包装,并“伪造”没有国家对象的案例

我认为下面的更改可能只适用于在缺少对象的情况下显示“全局”

var CountryCell=({rowIndex,data,col,…props})=>(
{data[rowIndex][col]?data[rowIndex][col]:'Global'}
);