File upload stuck on loading

106 views
Skip to first unread message

system out

unread,
Oct 10, 2022, 3:04:58 PM10/10/22
to GWT Users
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?

system out

unread,
Oct 11, 2022, 10:17:27 AM10/11/22
to GWT Users
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

Thomas Broyer

unread,
Oct 11, 2022, 12:57:04 PM10/11/22
to GWT Users
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)

system out

unread,
Oct 12, 2022, 5:59:26 AM10/12/22
to GWT Users
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.

system out

unread,
Oct 12, 2022, 6:24:41 AM10/12/22
to GWT Users
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

Craig Mitchell

unread,
Oct 12, 2022, 6:59:13 AM10/12/22
to GWT Users
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.  :)

Craig Mitchell

unread,
Oct 12, 2022, 7:00:38 AM10/12/22
to GWT Users
Correction:   <input ui:field="fileInput" type="file" />

system out

unread,
Oct 12, 2022, 7:15:40 AM10/12/22
to GWT Users
Thanks Craig for your response.
Sadly I can't change that part as too much treatment is happening on the server side and data us being communiated as it is to the client.
Same issue happens if I comment the loader.load() then hit the refresh button.IMG_20221012_131516.jpg

system out

unread,
Oct 12, 2022, 2:15:01 PM10/12/22
to GWT Users
I found that line 59 is what fails. That's why the loader fails.

Offset, newList and size are not null.

please check the attached images 


system out

unread,
Oct 12, 2022, 2:16:15 PM10/12/22
to GWT Users
Reply all
Reply to author
Forward
0 new messages