【发布时间】:2022-08-18 19:18:03
【问题描述】:
我需要使我当前的可拖动组件的下拉列表不在特定单元格(特别是第一行)上呈现。但是,它仍然会显示没有下拉列表的单元格。我试图寻找一种方法,但找不到任何方法。感谢提供的任何帮助/指示。谢谢!我还附上了当前和预期的屏幕截图。 (请注意下拉菜单为空)
带有 ant 设计组件 Row/Col 和 Select/Option 下拉菜单的主要代码:
render() {
return (
<div>
<Table
scroll={{ x: 300 }}
pagination={{
defaultPageSize: 10,
showSizeChanger: true,
pageSizeOptions: [\'10\', \'25\', \'50\'],
}}
columns={this.state.columns}
dataSource={this.state.datas}
></Table>
<Modal
destroyOnClose={true}
width={\'80%\'}
title=\'Approval Sequence\'
visible={this.state.isVisible}
onOk={() => {
updateFlowType(this.state.currentItem.id, {
name: this.state.currentItem.name,
sites: this.state.initTags.map((x) => ({
idSite: x.id,
returnToStep: x.returnToStep,
})),
})
.then((r) => {
notification[\'sucess\']({
message: \'Success\',
description: \'Save data success\',
});
this.setState({ isVisible: false });
this.getData();
})
.catch(() => {
notification[\'failed\']({
message: \'Failed\',
description: \'Failed to save\',
});
});
}}
onCancel={() => {
this.setState({ isVisible: false });
}}
>
<Row gutter={[2, 2]}>
<Col style={{ textAlign: \'center\' }} span={8}>
<Text strong>Role</Text>
</Col>
<Col style={{ textAlign: \'center\' }} span={8}>
<Text strong> Return to Department: </Text>
</Col>
</Row>
<div className=\'list-area\'>
<div className=\'drag-list\'>
<DraggableArea
onChange={(initTags) => this.setState({ initTags })}
isList
tags={this.state.initTags}
render={({ tag }) => (
<Row>
<Col span={8}>
<Button style={{ width: \'100%\' }}>{tag.name}</Button>
</Col>
<Col span={16}>
<Select
onChange={(e) => {
//create clone
let clone = [...this.state.initTags];
let item = clone.find((x) => x.id === tag.id);
let itemReject = clone.find((x) => x.name === e);
console.log(\'itemReject\', itemReject);
//create returnToStep in item
item.returnToStep = itemReject.id;
this.setState({
initTags: clone,
});
}}
//placeholder = \'Select return step\'
style={{ width: \'100%\' }}
>
{this.getReject(tag.name).map((newTag) => (
//getReject function will slice to get only items before the current iteration object (e.g. if current is index 3, only get index 0~2)
<Option key={newTag.name} value={newTag.name}>
{newTag.name}
</Option>
))}
</Select>
</Col>
</Row>
)}
></DraggableArea>
</div>
</div>
</Modal>
</div>
);
}
标签: javascript reactjs axios antd