Added delete button to entity lists.

This commit is contained in:
Tomas Bures 2018-09-28 14:51:55 +02:00
parent bc818aaee2
commit 2b57396a5d
22 changed files with 312 additions and 67 deletions

View file

@ -16,6 +16,7 @@ import { withPageHelpers } from './page'
import { withErrorHandling, withAsyncErrorHandler } from './error-handling';
import styles from "./styles.scss";
import {getUrl} from "./urls";
import {Table} from "./table";
const TreeSelectMode = {
NONE: 0,
@ -23,7 +24,7 @@ const TreeSelectMode = {
MULTI: 2
};
@translate()
@translate(null, { withRef: true })
@withPageHelpers
@withErrorHandling
class TreeTable extends Component {
@ -46,6 +47,13 @@ class TreeTable extends Component {
selectMode: TreeSelectMode.NONE
}
refresh() {
if (this.tree) {
this.tree.reload(this.sanitizeTreeData(this.state.treeData));
this.updateSelection();
}
}
@withAsyncErrorHandler
async loadData(dataUrl) {
const response = await axios.get(getUrl(dataUrl));
@ -323,6 +331,15 @@ class TreeTable extends Component {
}
}
/*
Refreshes the table. This method is provided to allow programmatic refresh from a handler outside the table.
The reference to the table can be obtained by ref.
*/
TreeTable.prototype.refresh = function() {
this.getWrappedInstance().refresh();
};
export {
TreeTable,
TreeSelectMode