You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm exploring how to properly integrate the VirtualScroller component with a backend that provides paginated responses. For context, a paginated API delivers data in discrete chunks or "pages." Here’s an example of a typical paginated API response and how the data is queried:
API Query Example:
GET /items?page=1
API Response Format:
{
"total": 50,
"per_page": 15,
"current_page": 1,
"data": [
{
// Data record...
},
{
// More data records...
}
]
}
As outlined in the lazy loading section of the VirtualScroller documentation, the example initializes with a fixed-sized array. However, in real applications where the size of the dataset can change and isn't known in advance, I would initialize the component with something like const items = ref([]).
However, I find that attempting to dynamically load more data or otherwise change the size of the items array results in unpredictable behavior, suggesting that the component might be expecting a fixed-size array as shown in the VirtualScroller documentation.
I would appreciate it if somebody could provide concrete examples or advice on how to effectively wire the VirtualScroller with paginated APIs. I'm particularly interested in tips on managing dynamically changing data sizes and ensuring a smooth user experience.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello PrimeVue experts,
I'm exploring how to properly integrate the VirtualScroller component with a backend that provides paginated responses. For context, a paginated API delivers data in discrete chunks or "pages." Here’s an example of a typical paginated API response and how the data is queried:
API Query Example:
GET /items?page=1
API Response Format:
As outlined in the lazy loading section of the VirtualScroller documentation, the example initializes with a fixed-sized array. However, in real applications where the size of the dataset can change and isn't known in advance, I would initialize the component with something like
const items = ref([])
.However, I find that attempting to dynamically load more data or otherwise change the size of the
items
array results in unpredictable behavior, suggesting that the component might be expecting a fixed-size array as shown in the VirtualScroller documentation.I would appreciate it if somebody could provide concrete examples or advice on how to effectively wire the VirtualScroller with paginated APIs. I'm particularly interested in tips on managing dynamically changing data sizes and ensuring a smooth user experience.
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions