|
@ -92,16 +92,18 @@ let AntTable = React.createClass({ |
|
|
this.fetch(); |
|
|
this.fetch(); |
|
|
}, |
|
|
}, |
|
|
handleSelectFilter(column, selected) { |
|
|
handleSelectFilter(column, selected) { |
|
|
column.selectedFilters = column.selectedFilters || []; |
|
|
|
|
|
column.selectedFilters.push(selected); |
|
|
column.selectedFilters.push(selected); |
|
|
}, |
|
|
}, |
|
|
handleDeselectFilter(column, key) { |
|
|
handleDeselectFilter(column, key) { |
|
|
column.selectedFilters = column.selectedFilters || []; |
|
|
|
|
|
var index = column.selectedFilters.indexOf(key); |
|
|
var index = column.selectedFilters.indexOf(key); |
|
|
if (index !== -1) { |
|
|
if (index !== -1) { |
|
|
column.selectedFilters.splice(index, 1); |
|
|
column.selectedFilters.splice(index, 1); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
handleClearFilters(column) { |
|
|
|
|
|
column.selectedFilters = []; |
|
|
|
|
|
this.fetch(); |
|
|
|
|
|
}, |
|
|
handleSelect(e) { |
|
|
handleSelect(e) { |
|
|
let checked = e.currentTarget.checked; |
|
|
let checked = e.currentTarget.checked; |
|
|
let currentRowIndex = e.currentTarget.parentElement.parentElement.rowIndex; |
|
|
let currentRowIndex = e.currentTarget.parentElement.parentElement.rowIndex; |
|
@ -169,20 +171,31 @@ let AntTable = React.createClass({ |
|
|
} |
|
|
} |
|
|
let filterDropdown, menus, sortButton; |
|
|
let filterDropdown, menus, sortButton; |
|
|
if (column.filters && column.filters.length > 0) { |
|
|
if (column.filters && column.filters.length > 0) { |
|
|
|
|
|
column.selectedFilters = column.selectedFilters || []; |
|
|
menus = <Menu multiple={true} |
|
|
menus = <Menu multiple={true} |
|
|
className="ant-table-filter-dropdown" |
|
|
className="ant-table-filter-dropdown" |
|
|
onSelect={this.handleSelectFilter.bind(this, column)} |
|
|
onSelect={this.handleSelectFilter.bind(this, column)} |
|
|
onDeselect={this.handleDeselectFilter.bind(this, column)}> |
|
|
onDeselect={this.handleDeselectFilter.bind(this, column)} |
|
|
|
|
|
selectedKeys={column.selectedFilters}> |
|
|
{this.renderMenus(column.filters)} |
|
|
{this.renderMenus(column.filters)} |
|
|
|
|
|
<Menu.Divider /> |
|
|
<Menu.Item disabled> |
|
|
<Menu.Item disabled> |
|
|
<button style={{ |
|
|
<a className="ant-table-filter-dropdown-link confirm" |
|
|
|
|
|
style={{ |
|
|
cursor: 'pointer', |
|
|
cursor: 'pointer', |
|
|
pointerEvents: 'visible' |
|
|
pointerEvents: 'visible' |
|
|
}} |
|
|
}} |
|
|
className="ant-btn ant-btn-primary ant-btn-sm" |
|
|
|
|
|
onClick={this.handleFilter.bind(this, column)}> |
|
|
onClick={this.handleFilter.bind(this, column)}> |
|
|
确 定 |
|
|
确定 |
|
|
</button> |
|
|
</a> |
|
|
|
|
|
<a className="ant-table-filter-dropdown-link clear" |
|
|
|
|
|
style={{ |
|
|
|
|
|
cursor: 'pointer', |
|
|
|
|
|
pointerEvents: 'visible' |
|
|
|
|
|
}} |
|
|
|
|
|
onClick={this.handleClearFilters.bind(this, column)}> |
|
|
|
|
|
清空 |
|
|
|
|
|
</a> |
|
|
</Menu.Item> |
|
|
</Menu.Item> |
|
|
</Menu>; |
|
|
</Menu>; |
|
|
let dropdownSelectedClass = ''; |
|
|
let dropdownSelectedClass = ''; |
|
|