mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 00:13:35 +01:00
1bfd3ac6fe
Plus some vertical spacing fixes
1.2 KiB
1.2 KiB
<et2-vfs-select-dialog class="file-select"></et2-vfs-select-dialog>
<et2-button noSubmit>Open dialog</et2-button>
// TODO: This doesn't work because of Dialog / keymanager issues
<script>
const dialog = document.querySelector('.file-select');
const openButton = dialog.nextElementSibling;
openButton.addEventListener('click', () => {dialog.show()});
</script>
Selected files
You can get the selected files by:
Widget value
If the dialog is in the template, it will return values on submit back to the server.
Change event
When the selected file(s) change, the change event is fired
const dialog = this.et2.getWidgetById("files");
dialog.addEventListener("change", this.handleFilesSelected);
getComplete() Promise
When the user closes the dialog, getComplete() will return the selected files.
const dialog = this.et2.getWidgetById("files");
let [button, files] = await dialog.getComplete();
This is probably the best way to get files (or directories) that you then want to do something with on the client. See also Et2VfsSelectButton which can pass the files to take action on the server.