SAP / openui5

OpenUI5 lets you build enterprise-ready web applications, responsive to all devices, running on almost any browser of your choice.
http://openui5.org
Apache License 2.0
2.92k stars 1.23k forks source link

sap.m.upload.UploadSet incompleteItem setSelectItem does not work #4026

Closed cbsmerveguel closed 1 month ago

cbsmerveguel commented 3 months ago

Hi gurus,

We are using UploadSet with "incompleteItem" aggregation due to the fact that we are processing the uploaded documents first and set them as "Complete" at a later point. As the processing gets finished, we set the incompleteItem's uploadState as "sap.m.UploadState.Complete". Right after this completion, we required to select the the first item that is completed in the "incompleteItem" list. However, as we tried to apply this functionality, we got to see that the "setSelectedItem" method throws the below error:

image

Code Snap:

          if (!bIsSelected && oIncompleteItem.getUploadState() === this._aMainConstants.COMPLETE) {
            uploadSet.setSelectedItemById(oIncompleteItem.getId(), true);
            uploadSet.fireSelectionChanged();
            bIsSelected = true;
          }

sap.m.upload.UploadSet 1.120.8 As we debugged the issue and as can be seen in the method "_getUploadSetItemById"; this.getItems() collects the items only from "items" aggregation and it is empty. Ideally, we would expect our item to be selectable either as a incompleteItem or an actual item regardless of its uploadState. Therefore, we think this.getItems() should also support the array of incompleteItems list. We also would expect that, if an incompleteItem gets an update to its uploadState as "sap.m.UploadState.Complete", then it should be added into the "items" aggregation. We tried to manually remove the item from the "incompleteItem" aggregation and add/insert it into the "items" aggregation but it didn't work, because the object id was already used and removed.

image

We are asking your support and expertise on this matter,

Thanks in advance,

Best, Merve

dimovpetar commented 3 months ago

Hello @cbsmerveguel ,

I have prepared a small test page that shows the first issue with setSelectedItem https://stackblitz.com/edit/vitejs-vite-tvzjnv?file=index.js. Please check if this is what you have meant. For the second issue about upload state, please open another incident.

Best regards, Petar

cbsmerveguel commented 3 months ago

@dimovpetar thank you for the test page example, that is accurately displays our issue. I am raising a second incident for the latter issue.

FYI: sap.m.upload.UploadSet aggregations do not get an update as uploadState property shifts

Thanks again! Best, Merve

dimovpetar commented 3 months ago

Hello @cbsmerveguel ,

I've created an internal incident DINC0128813. The status of the issue will be updated here in GitHub.

Regards, Petar

I562693 commented 1 month ago

Hi Devs,

From the details and scenario above i can understand the goal is to move the incomplete item to items manually as per need. The uploadset control moves the items from incomplete list to complete list only once upload has progressed. if it has to be moved manually either u can use insertItem or addItem API on the uploadSet control by passing in the incomplete item so the control handles moving it from incomplete list to items list. Then the setselected works on the moved item. This approach should handle the above use-case please let us know otherwise.

Regards, Vinay