2016-03-31 09:40:55 +08:00
|
|
|
---
|
|
|
|
order: 10
|
2016-07-31 09:53:51 +08:00
|
|
|
title:
|
|
|
|
zh-CN: 高级搜索
|
|
|
|
en-US: Advanced search
|
2016-03-31 09:40:55 +08:00
|
|
|
---
|
2015-12-29 23:39:21 +08:00
|
|
|
|
2016-07-31 09:53:51 +08:00
|
|
|
## zh-CN
|
|
|
|
|
2015-12-29 23:39:21 +08:00
|
|
|
三列栅格式的表单排列方式,常用于数据表格的高级搜索。
|
|
|
|
|
|
|
|
有部分定制的样式代码,由于输入标签长度不确定,需要根据具体情况自行调整。
|
|
|
|
|
2016-07-31 09:53:51 +08:00
|
|
|
## en-US
|
|
|
|
|
2016-08-05 11:25:39 +08:00
|
|
|
Three columns layout is often used for advanced searching of data table.
|
2016-07-31 09:53:51 +08:00
|
|
|
|
2016-08-05 11:25:39 +08:00
|
|
|
Because the width of label is not fixed, you may need to adjust it by customizing its style.
|
2016-07-31 09:53:51 +08:00
|
|
|
|
2016-08-05 11:47:31 +08:00
|
|
|
|
2015-12-29 23:39:21 +08:00
|
|
|
````jsx
|
2016-04-12 14:55:02 +08:00
|
|
|
import { Form, Input, Row, Col, Button, DatePicker } from 'antd';
|
2015-12-29 23:39:21 +08:00
|
|
|
const FormItem = Form.Item;
|
|
|
|
|
|
|
|
ReactDOM.render(
|
2016-04-29 12:13:27 +08:00
|
|
|
<Form horizontal className="ant-advanced-search-form">
|
|
|
|
<Row gutter={16}>
|
|
|
|
<Col sm={8}>
|
|
|
|
<FormItem
|
2016-07-31 09:53:51 +08:00
|
|
|
label="Search name"
|
2016-04-29 12:13:27 +08:00
|
|
|
labelCol={{ span: 10 }}
|
2016-06-06 13:54:10 +08:00
|
|
|
wrapperCol={{ span: 14 }}
|
|
|
|
>
|
2016-07-31 09:53:51 +08:00
|
|
|
<Input placeholder="Please input the search name" size="default" />
|
2016-04-29 12:13:27 +08:00
|
|
|
</FormItem>
|
|
|
|
<FormItem
|
2016-07-31 09:53:51 +08:00
|
|
|
label="Long search name"
|
2016-04-29 12:13:27 +08:00
|
|
|
labelCol={{ span: 10 }}
|
2016-06-06 13:54:10 +08:00
|
|
|
wrapperCol={{ span: 14 }}
|
|
|
|
>
|
2016-04-29 12:13:27 +08:00
|
|
|
<DatePicker size="default" />
|
|
|
|
</FormItem>
|
|
|
|
<FormItem
|
2016-07-31 09:53:51 +08:00
|
|
|
label="Search name"
|
2016-04-29 12:13:27 +08:00
|
|
|
labelCol={{ span: 10 }}
|
2016-06-06 13:54:10 +08:00
|
|
|
wrapperCol={{ span: 14 }}
|
|
|
|
>
|
2016-07-31 09:53:51 +08:00
|
|
|
<Input placeholder="Please input the search name" size="default" />
|
2016-04-29 12:13:27 +08:00
|
|
|
</FormItem>
|
|
|
|
</Col>
|
|
|
|
<Col sm={8}>
|
|
|
|
<FormItem
|
2016-07-31 09:53:51 +08:00
|
|
|
label="Search name"
|
2016-04-29 12:13:27 +08:00
|
|
|
labelCol={{ span: 10 }}
|
2016-06-06 13:54:10 +08:00
|
|
|
wrapperCol={{ span: 14 }}
|
|
|
|
>
|
2016-07-31 09:53:51 +08:00
|
|
|
<Input placeholder="Please input the search name" size="default" />
|
2016-04-29 12:13:27 +08:00
|
|
|
</FormItem>
|
|
|
|
<FormItem
|
2016-07-31 09:53:51 +08:00
|
|
|
label="Long search name"
|
2016-04-29 12:13:27 +08:00
|
|
|
labelCol={{ span: 10 }}
|
2016-06-06 13:54:10 +08:00
|
|
|
wrapperCol={{ span: 14 }}
|
|
|
|
>
|
2016-04-29 12:13:27 +08:00
|
|
|
<DatePicker size="default" />
|
|
|
|
</FormItem>
|
|
|
|
<FormItem
|
2016-07-31 09:53:51 +08:00
|
|
|
label="Search name"
|
2016-04-29 12:13:27 +08:00
|
|
|
labelCol={{ span: 10 }}
|
2016-06-06 13:54:10 +08:00
|
|
|
wrapperCol={{ span: 14 }}
|
|
|
|
>
|
2016-07-31 09:53:51 +08:00
|
|
|
<Input placeholder="Please input the search name" size="default" />
|
2016-04-29 12:13:27 +08:00
|
|
|
</FormItem>
|
|
|
|
</Col>
|
|
|
|
<Col sm={8}>
|
|
|
|
<FormItem
|
2016-07-31 09:53:51 +08:00
|
|
|
label="Search name"
|
2016-04-29 12:13:27 +08:00
|
|
|
labelCol={{ span: 10 }}
|
2016-06-06 13:54:10 +08:00
|
|
|
wrapperCol={{ span: 14 }}
|
|
|
|
>
|
2016-07-31 09:53:51 +08:00
|
|
|
<Input placeholder="Please input the search name" size="default" />
|
2016-04-29 12:13:27 +08:00
|
|
|
</FormItem>
|
|
|
|
<FormItem
|
2016-07-31 09:53:51 +08:00
|
|
|
label="Long search name"
|
2016-04-29 12:13:27 +08:00
|
|
|
labelCol={{ span: 10 }}
|
2016-06-06 13:54:10 +08:00
|
|
|
wrapperCol={{ span: 14 }}
|
|
|
|
>
|
2016-04-29 12:13:27 +08:00
|
|
|
<DatePicker size="default" />
|
|
|
|
</FormItem>
|
|
|
|
<FormItem
|
2016-07-31 09:53:51 +08:00
|
|
|
label="Search name"
|
2016-04-29 12:13:27 +08:00
|
|
|
labelCol={{ span: 10 }}
|
2016-06-06 13:54:10 +08:00
|
|
|
wrapperCol={{ span: 14 }}
|
|
|
|
>
|
2016-07-31 09:53:51 +08:00
|
|
|
<Input placeholder="Please input the search name" size="default" />
|
2016-04-29 12:13:27 +08:00
|
|
|
</FormItem>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
<Row>
|
|
|
|
<Col span={12} offset={12} style={{ textAlign: 'right' }}>
|
2016-07-31 09:53:51 +08:00
|
|
|
<Button type="primary" htmlType="submit">Search</Button>
|
|
|
|
<Button>Clear</Button>
|
2016-04-29 12:13:27 +08:00
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
</Form>
|
2015-12-29 23:39:21 +08:00
|
|
|
, mountNode);
|
|
|
|
````
|
|
|
|
|
|
|
|
````css
|
2016-07-31 09:53:51 +08:00
|
|
|
/* custom style */
|
2015-12-29 23:39:21 +08:00
|
|
|
|
2016-04-06 12:08:40 +08:00
|
|
|
.ant-advanced-search-form {
|
2015-12-29 23:39:21 +08:00
|
|
|
padding: 16px 8px;
|
2015-12-29 23:43:10 +08:00
|
|
|
background: #f8f8f8;
|
2015-12-29 23:39:21 +08:00
|
|
|
border: 1px solid #d9d9d9;
|
|
|
|
border-radius: 6px;
|
|
|
|
}
|
|
|
|
|
2016-08-08 15:43:21 +08:00
|
|
|
/* because the label length is variable, you may need to adjust the left edge to have the form centered */
|
2016-08-05 11:47:31 +08:00
|
|
|
|
2016-06-06 11:40:54 +08:00
|
|
|
.ant-advanced-search-form > .ant-row {
|
2016-02-25 18:03:48 +08:00
|
|
|
position: relative;
|
|
|
|
left: -6px;
|
2015-12-29 23:39:21 +08:00
|
|
|
}
|
|
|
|
|
2016-04-06 12:08:40 +08:00
|
|
|
.ant-advanced-search-form .ant-btn + .ant-btn {
|
2015-12-29 23:39:21 +08:00
|
|
|
margin-left: 8px;
|
|
|
|
}
|
|
|
|
````
|
|
|
|
|
|
|
|
<style>
|
2015-12-29 23:43:10 +08:00
|
|
|
#components-form-demo-advanced-search-form .ant-form-horizontal {
|
2015-12-29 23:39:21 +08:00
|
|
|
max-width: none;
|
|
|
|
}
|
|
|
|
</style>
|