1

currently I am using Gridjs to display my table in my Reactjs application.

enter image description here

This is the code, the Name, and Email is displaying correctly, but the created_at is not, giving me empty. How can I display the data? thank you..

Muneeb K
  • 457
  • 1
  • 9
  • 21

1 Answers1

2

You need to define a custom id for your column if you're using a JSON input.

Example:

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' },
  ]
});

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

Afshin Mehrabani
  • 33,262
  • 29
  • 136
  • 201