SAP / fundamental-ngx

Fundamental Library for Angular is SAP Design System Angular component library
https://sap.github.io/fundamental-ngx
Apache License 2.0
256 stars 125 forks source link

[BUG] implementing custom platform table loading logic #11800

Closed esporysz closed 2 weeks ago

esporysz commented 3 weeks ago

In documentation https://fundamental-ngx.netlify.app/#/platform/table/basic#loading we can read:

By default, Table tracks these loading events and apply loading state internally. However, you can modify this logic by using onDataRequested and onDataReceived methods and loading input on the component

Currently it is not possible to use loading Input because this is private field private loading: boolean | undefined;.

Needed input to implement custom loading logic.

mikerodonnell89 commented 3 weeks ago

Can you instead use the public loadingState? https://github.com/SAP/fundamental-ngx/blob/92d29641465f47392e34dfb8613ec66624bc0d11/libs/platform/table/table.component.ts#L626

The docs are a bit confusing, I'm wondering if the initial intent was that they're referring to the "loading" property on the example component, not the table component. We do need to address this in the docs, I'll open a PR

esporysz commented 3 weeks ago

Thank you for your answer, loadingState is a getter. I need sth to set loading value and delay loading indicator visibility. Is is currently possible?

mikerodonnell89 commented 3 weeks ago

@dmitry-stepanenko Do you recall why you made this input private? From this PR: https://github.com/SAP/fundamental-ngx/pull/7671

The documentation has me inclined to think we want to keep it public, allowing the application developer to handle loading state manually, if they desire

dmitry-stepanenko commented 2 weeks ago

Hey @mikerodonnell89, most likely it was set as private to prevent its usage from the template in favour of loadingState.

Probably it should be fine to make it public again or to create a public method to do that, which will still prevent the usage of loading variable in the template