Wednesday, October 12, 2022

Re: File upload stuck on loading

I have no clue what your error is, but it's so much easier to read files with HTML5 now.

Something like this:
-----
<input ui:field="fileInput" style="display: none;" type="file" />

@UiField InputElement fileInput;

Event.sinkEvents(fileInput, Event.ONCHANGE);
Event.setEventListener(fileInput, event -> handleFileUpload());

private void handleFileUpload() {
    JavaScriptObject files = fileInput.getPropertyJSO("files");
   
    if (files instanceof JsArray) {
        JsArray<JavaScriptObject> filesArray = (JsArray<JavaScriptObject>)files;
       
        if (filesArray.length() > 0) {
            handleFileUploadJS(filesArray.get(0),  fileData -> handleAfterFileUpload(fileData));
        }
    }
}

private static native void handleFileUploadJS(JavaScriptObject fileData) /*-{
    var fileReader = new FileReader();
    fileReader.addEventListener("load", function () {
        // Your file data will be in fileReader.result
    }, false);
    fileReader.readAsDataURL(fileData);
}-*/;
-----

No server code needed.  :)

On Wednesday, 12 October 2022 at 9:24:41 pm UTC+11 system.out...@gmail.com wrote:
For file upload we are using GXT FileUploadField.
for server we are using servlets that extends GWT RemoteServiceServlet
There's a UploadExcelHandler that on success send. a notification. It uses puremvc4gwt.
We have a handle notification that gets the received data and calles methods to update the grid and reload it 
( please read my last message for the reload, I found the root cause but no solution is found yet)
Thanks
Le mercredi 12 octobre 2022 à 11:59:26 UTC+2, system out a écrit :
Yes we are using GXT 2.2.5 with GWT 2.8.1
We have a custom Grid object created that has an EditoGrid, PagingToolbar, ListStore, ColumnModel and many other properties like height..
I found that the problem is caused by the load method inside the PagingLoader.
we have this line: 
grid.reconfigure(store, grid.getColumnModel())
then the following line that causes the error:
loader.load(config).
config is a PagingLoadConfig
I tried loader.load() and loader.load(0.50) and grid.getStore().getLoader().load()
but nothing seems to work.

Le mardi 11 octobre 2022 à 18:57:04 UTC+2, t.br...@gmail.com a écrit :
It would certainly help if you provided details on how you do the upload (using GWT's own FormPanel and FileUpload? or a third-party library? GXT-specific widgets?) and how you handle the response (including how you generate it server-side)
On Tuesday, October 11, 2022 at 4:17:27 PM UTC+2 system.out...@gmail.com wrote:
I managed to print results on client side. I use alerts to chek.
The list is received as it is, we have a method that will fill the grid with that list but somethiing is stopping it. It still print a loading spinner that never stops. 
The same code works well with gwt 2.4/gxt 2.2.5.
Now we are using gwt 2.8/gxt 2.2.5

Le lundi 10 octobre 2022 à 21:04:58 UTC+2, system out a écrit :
I migtated gwt app from 2.4 to 2.8
After fixing build erros the app launches and interfaces are appearing.
We have a excel file upload.
When I click upload it is stuck on loading. A loading text appears and result never shows up.
There a method that takes data imported from excel and put fill some objects with it.
The data is well imported. The method that fill objects with it will return the filled objects as a List. When I return an empty list it works.
Do you know if there's something that should be changed due to the migration?

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/7987c8a0-8cf6-43d9-b5cb-b0ac9784d54bn%40googlegroups.com.

No comments:

Post a Comment