SAP / ui5-webcomponents

UI5 Web Components - the enterprise-flavored sugar on top of native APIs! Build SAP Fiori user interfaces with the technology of your choice.
https://sap.github.io/ui5-webcomponents/
Apache License 2.0
1.51k stars 263 forks source link

[SF][ui5-table]: loadmore event will be triggered if set table row data later #6243

Closed GongRichard closed 1 year ago

GongRichard commented 1 year ago

Bug Description

loadmore event will be triggered if set table row data later

Expected Behavior

loadmore event shouldn't be triggered if loading data finished after table rendering

Steps to Reproduce

  1. Go to 'https://codesandbox.io/s/jolly-northcutt-mcgron?file=/src/App.js'
  2. adjust right side content with more width
  3. refresh right side content
  4. check console log and you will see loadmore event was triggered

Isolated Example

https://codesandbox.io/s/jolly-northcutt-mcgron?file=/src/App.js

Context

Log Output / Stack Trace / Screenshots

image

Priority

The priority indicates the severity of the issue. To set the appropriate priority consider the following criteria:

Note: The priority might be re-evaluated by the issue processor.

Stakeholder Info (if applicable)

mindarelus commented 1 year ago

The bug is very easy reproducible in the example. According to the documentation:

onLoadMore | Fired when the user presses the More button or scrolls to the table's end. Note: The event will be fired if growing is set to Button or Scroll.

mindarelus commented 1 year ago

Hello @SAP/ui5-webcomponents-topic-rl , take a look of this issue. The related doc: https://sap.github.io/ui5-webcomponents/playground/components/Table/ see the load more section

elenastoyanovaa commented 1 year ago

Hello @mindarelus ,

Could you please verify if the issue is present with plain ui5-table and return the ticket back to us with a link to a sample, where we could reproduce the issue with ui5 web components?

Thanks in advance!

Kind Regards, Elena

ndeshev commented 1 year ago

Hello @GongRichard,

I'm not able to reproduce the issue with plainTable UI5 WebComponent.

https://codesandbox.io/s/ui5-webcomponents-forked-fo2wor?file=/index.html

The load-more event is only triggered when the table is scrolled to the bottom.

If there is something missing in the snippet that needs to be added in order to reproduce the problem please do so.

ndeshev commented 1 year ago

Hello again, seems like the event is triggered when the table is scrolled to the end, but that is also true on initial rendering if there is no scroll present. I will check this with my team and respond to you with update shortly.

ndeshev commented 1 year ago

Hello @GongRichard, we discussed the issue and the observed behavior is desired. When the table is set to 'growing' and is rendered there is enough vertical space for all rows - the 'load-more' event is fired the same it is when scrolled to bottom, if scroll is present.

In your case you are rendering empty table and add the rows later but it case is the same - the table bottom end is visible so the event is fired. It can not know if there will be items added some time in the future in order to respond to this statement: loadmore event shouldn't be triggered if loading data finished after table rendering

Could you please elaborate what is your specific use case and why is this an issue for you. Thanks.

GongRichard commented 1 year ago

Hi @ndeshev, As we has lots of rows, we need do pagination. And we want to let user to scroll down to trigger the 'load-more' event to load more data. In this case, for the first time, it will auto trigger the 'load-more' event and load 2 pages data. It doesn't make sense to us. Thanks, Richard

ivoplashkov commented 1 year ago

Hello @GongRichard,

As @ndeshev has stated in his reply: "since the table bottom end is visible, the event is fired. We can not determine if there will be items added some time in the future."

I am closing this issue as we consider this to be the expeceted behavior of the event.

Best regards, Ivaylo