Web: Files: added onExpand to TreeFolders, removed setFilter from FilesRowContent
This commit is contained in:
parent
8119d2884e
commit
6dcca4c0e1
@ -11,7 +11,7 @@ class TreeFolders extends React.Component {
|
||||
|
||||
const treeData = props.data;
|
||||
|
||||
this.state = { treeData };
|
||||
this.state = { treeData, expandedKeys: this.props.expandedKeys };
|
||||
|
||||
this.ref = React.createRef();
|
||||
}
|
||||
@ -160,9 +160,13 @@ class TreeFolders extends React.Component {
|
||||
});
|
||||
};
|
||||
|
||||
onExpand = data => {
|
||||
this.setState({expandedKeys: data})
|
||||
}
|
||||
|
||||
render() {
|
||||
const { selectedKeys, fakeNewDocuments, expandedKeys } = this.props;
|
||||
const { treeData } = this.state;
|
||||
const { selectedKeys, fakeNewDocuments } = this.props;
|
||||
const { treeData, expandedKeys } = this.state;
|
||||
|
||||
//console.log("TreeFolders render", this.props);
|
||||
return (
|
||||
@ -181,6 +185,7 @@ class TreeFolders extends React.Component {
|
||||
onBadgeClick={() => console.log("onBadgeClick")}
|
||||
loadData={this.onLoadData}
|
||||
expandedKeys={expandedKeys}
|
||||
onExpand={this.onExpand}
|
||||
>
|
||||
{this.getItems(treeData)}
|
||||
</TreeMenu>
|
||||
|
@ -98,7 +98,7 @@ class FilesRowContent extends React.PureComponent {
|
||||
|
||||
onFilesClick = () => {
|
||||
const { id, fileExst } = this.props.item;
|
||||
const { filter, setFilter } = this.props;
|
||||
const { filter } = this.props;
|
||||
if (!fileExst) {
|
||||
const a =
|
||||
history.location.search !== ""
|
||||
@ -107,19 +107,9 @@ class FilesRowContent extends React.PureComponent {
|
||||
const url = `${history.location.pathname}${a}`;
|
||||
history.push(`${url}#${id}`);
|
||||
|
||||
|
||||
fetchFiles(id, filter, store.dispatch).then(data => {
|
||||
const newFilter = filter.clone();
|
||||
if (
|
||||
newFilter.treeFolders.indexOf(
|
||||
data.selectedFolder.parentId.toString()
|
||||
) === -1
|
||||
) {
|
||||
newFilter.treeFolders.push(data.selectedFolder.parentId.toString());
|
||||
}
|
||||
newFilter.treeFolders.push(id.toString());
|
||||
setFilter(newFilter);
|
||||
});
|
||||
const newFilter = filter.clone();
|
||||
newFilter.treeFolders.push(id.toString());
|
||||
fetchFiles(id, newFilter, store.dispatch);
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user