Merge pull request #1547 from 2betop/filterable

非 loadDataOnce 模式 filterable: true 也可以自动从当前数据中提取选项
This commit is contained in:
RickCole 2021-02-05 11:27:03 +08:00 committed by GitHub
commit 8f469b34bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -342,7 +342,7 @@ export default class App extends React.Component<AppProps, object> {
}}
isActive={(link: any) => !!env.isCurrentUrl(link?.path, link)}
/>
{asideBefore ? render('aside-before', asideBefore) : null}
{asideAfter ? render('aside-before', asideAfter) : null}
</>
);
}

View File

@ -45,7 +45,7 @@ export class HeadCellFilterDropDown extends React.Component<
}
componentDidMount() {
const {filterable} = this.props;
const {filterable, name, store} = this.props;
if (filterable.source) {
this.fetchOptions();
@ -80,9 +80,10 @@ export class HeadCellFilterDropDown extends React.Component<
} else if (
name &&
!this.state.filterOptions.length &&
Array.isArray(props.store?.data.itemsRaw)
(Array.isArray(props.store?.data.itemsRaw) ||
Array.isArray(props.store?.data.items))
) {
const itemsRaw = props.store?.data.itemsRaw;
const itemsRaw = props.store?.data.itemsRaw || props.store?.data.items;
const values: Array<any> = [];
itemsRaw.forEach((item: any) => {
const value = getVariable(item, name);