如何将所选属性设置为qazxsw poi组件内的选项?我还没有意识到如何设置选定的属性。
我已经尝试过选择一个属性,但它似乎没有用。
<SelectArrayInput>
我希望const tec = [
{ name: "Apple", id: 1, selected: true},
{ name: "Facebook", id: 2 },
{ name: "Netflix", id: 3 },
{ name: "Tesla", id: 4 },
];
const ReferrenceSelectBox = ({ source, record = {} }) => <SelectArrayInput choices={ tec } />;
ReferrenceSelectBox.propTypes = {
label: PropTypes.string,
record: PropTypes.object,
source: PropTypes.string.isRequired,
};
export default ReferrenceSelectBox;
的输出已经选择了。
我无法获得使用<SelectArrayInput>
的代码沙箱,但是从react-admin
看起来它使用了Material-ui的documentation作为基础。
在Material-UI中,您可以传递要作为道具选择的值:Select
,它采用您想要的value
数组。
因此,在您的情况下,您可以创建另一个捕获ids
并将其作为selected
prop传递的数组,而不是使用selectedIds
属性,它应该可以工作。
value