0

目前我正在使用 Gridjs 在我的 Reactjs 应用程序中显示我的表格。

在此处输入图像描述

这是代码,NameEmail显示正确,但created_at不是,给我空。如何显示数据?谢谢你..

4

1 回答 1

1

id如果您使用 JSON 输入,则需要为您的列定义一个自定义项。

例子:

const grid = new Grid({
  columns: [{
     id: 'name',
     name: 'Name'
  }, {
     id: 'email',
     name: 'Email'
  }, {
     id: 'phoneNumber',
     name: 'Phone Number'
  }],
  data: [
    { name: 'John', email: 'john@example.com', phoneNumber: '(353) 01 222 3333' },
    { name: 'Mark', email: 'mark@gmail.com', phoneNumber: '(01) 22 888 4444' },
  ]
});

https://gridjs.io/docs/examples/import-json/

于 2021-01-07T23:51:55.173 回答