Wappler Version : 6.1.1 beta
Operating System :
Server Model:
Database Type:
Hosting Type:
Expected behavior
Upon selecting a file using the dropzone component, the file.dataUrl property should be set.
Actual behavior
file.dataUrl is null
How to reproduce
Use a dmx-dropzone component and select a file
<input is="dmx-dropzone" id="file_hero" type="file" name="file_hero" message="" accept=".png, .jpg, .jpeg" thumbs="false" dmx-on:click="hero_image_deleted.uncheck()">
George
February 22, 2024, 9:14pm
3
Actually this is a new feature
Because calculating a dataurl is a very heavy and memory intensive operation, we do it now fully on demand! So only if you have an active binding to it - then it will be calculated.
1 Like
Then it doesn’t appear to be working?
For example this img does not render once the file input has been selected.
<img dmx-bind:src="file_hero.file.dataUrl||get_sales_page.data.sales_page.hero_image_url" class="sales_page_image">
George
February 22, 2024, 9:19pm
5
Could you just try a single data binding expression to it?
George
February 22, 2024, 9:24pm
7
Ok @patrick will check it out tomorrow.
In general we are moving with ac2 more in the direction of optimized data bindings, so we calculated more things on demand only if they are really used to offer the best performance.
1 Like
patrick
February 23, 2024, 9:27am
8
Please check if this update fixes it: dmxDropzone.zip (7.2 KB)
Thanks Patrick, that works for dataUrl.
Now when I try to reset, I receive this error
<button id="btn_hero_delete" class="btn btn-primary" style="position: absolute; top: 1.25rem; left: 1.25rem;" dmx-on:click="file_hero.reset();hero_image_deleted.check()">
I also tried file_hero.remove()
but similar result.
What is the difference with reset and remove methods?
patrick
February 23, 2024, 3:52pm
10
The reset removes all files and resets to the defaultValue. The remove is just removing a single file.
The error is that it tries to remove the thumbnail which wasn’t created in your case, should be fixed in the following update.
dmxDropzone.zip (7.3 KB)
Teodor
Closed
March 2, 2024, 4:00pm
15
This topic was automatically closed after 45 hours. New replies are no longer allowed.