Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
cbsmerveguel opened this issue Apr 18, 2024 · 6 comments
Closed

Comments

@cbsmerveguel
Copy link

cbsmerveguel commented Apr 18, 2024

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 dimovpetar self-assigned this Apr 18, 2024
@dimovpetar
Copy link
Contributor

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
Copy link
Author

cbsmerveguel commented Apr 19, 2024

@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
Copy link
Contributor

Hello @cbsmerveguel ,

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

Regards,
Petar

@dimovpetar dimovpetar removed their assignment Apr 22, 2024
@I562693
Copy link
Contributor

I562693 commented Jun 4, 2024

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

@marcoss-html
Copy link

Hello, I'm a beginner in FIORI and I have a problem with the upload. As soon as the user selects the file, it downloads but goes through removeIncompleteItem and clears the screen, removing the file that the user uploaded. How can I make it so that after the upload the file remains on the screen? I noticed that if I skip removeIncompleteItem the file remains on the screen the way I would like it to. Thank you for all your help.

@dimovpetar
Copy link
Contributor

Hello @marcoss-html ,

Please create separate issue for your problem.

Best regards,
Petar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants