glittershark / reactable

Fast, flexible, and simple data tables in React
glittershark.github.io/reactable
MIT License
1.51k stars 222 forks source link

some cells are blank #130

Open bryanlarsen opened 9 years ago

bryanlarsen commented 9 years ago
<Reactable.Table className={"table table-striped "+(wide?"table-wide":"table-narrow")}
                       sortable={true}
                       itemsPerPage={3}
                        filterable={this.props.searchEnabled && ['Number', 'Status', 'Name', 'Date', 'otal', 'Submitted', 'Paid']} >
      {_.map(claims.toJS(), function(claim, index) {
        var clicker = this.clickRow.bind(this, claim.id);
        return (
          <Reactable.Tr key={claim.id}>
            <Reactable.Td column="Number" value={claim.number.toString()} handleClick={clicker}>{claim.number.toString()}</Reactable.Td>
            <Reactable.Td column="Status" value={claim.status} handleClick={clicker}>{claim.status}</Reactable.Td>
          </Reactable.Tr>
       );
    }, this)}
  </Reactable.Table>

displays nothing in any of the number cells. claim.number is a Number, so I added the toString() in a futile attempt to get it to appear. status, and most (but not all) of the other columns that I elided out work fine.

glittershark commented 9 years ago

Can you provide a sample (obviously not real :wink:) of what the result of a call to claims.toJS() might look like?

bryanlarsen commented 9 years ago

claims is an immutable-js array, so the output of toJS() is a plain old javascript array.

[
 {
  "submitted_fee": 0,
  "patient_number": "123",
  "patient_name": "Bob",
  "number": 1,
  "total_fee": 40563,
  "user_id": "6ae4643c-ba95-4ab6-b659-d5cefedbf2f8",
  "status": "for_agent",
  "paid_fee": 0,
  "service_date": "2015-01-06",
  "id": "64b8980f-bf14-401c-a564-983190579b35"
 },
 {
  "submitted_fee": 0,
  "patient_number": "123",
  "patient_name": "Bob",
  "number": 2,
  "total_fee": 7224,
  "user_id": "6ae4643c-ba95-4ab6-b659-d5cefedbf2f8",
  "status": "saved",
  "paid_fee": 0,
  "service_date": "2015-01-14",
  "id": "b4f5136d-357f-49c9-930c-db7c5b9a5580"
 }
]
glittershark commented 9 years ago

Cool, that's what I needed.