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" />
?
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" />
?
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;