0

I have status field the value is 0 and 1 which attribute type is integer, but I need to display as string/ convert to word which 1 is "accepted" and 0 is "rejected".

How do I change it in <TextField source="status" /> ?

Khalid
  • 887
  • 2
  • 13
  • 26

1 Answers1

1

You should write your own component. See example below

import React, { PropTypes } from 'react';

const CustomTextField = ({ source, record = {} }) => <span>{ (record[source] === 1) ? 'accepted' : 'rejected' }</span>;

CustomTextField.propTypes = {
    label: PropTypes.string,
    record: PropTypes.object,
    source: PropTypes.string.isRequired,
};

export default CustomTextField;
Deividas
  • 6,437
  • 2
  • 26
  • 27