primefaces / primevue

Next Generation Vue UI Component Library
https://primevue.org
MIT License
9.83k stars 1.18k forks source link

DataView incorrectly uses value prop #6281

Open yandzee opened 3 weeks ago

yandzee commented 3 weeks ago

Describe the bug

It seems like DataView component does wrong thing trying to take props.value.slice(first) to render entries. By doing go, this component effective forces user to represent data as continuous array. I will explain it in more details using my use case.

I store data in Map<page_idx, data_entry[]> and when page event is thrown by DataView, I put myDataMap.get(pageIdx) into value property (btw I also tried to set first prop to 0 and it didn't help). And it shows empty grid/list because actually it tries to take value.slice(data.d_first) for some reason. I know that by inspecting DataView component via vue dev tools and it shows data section where d_first and d_rows local variables reside. When I set d_first to zero - data starts to appear.

As temporal solution I simply ignore what I got in via grid/list slot items field and use my computed page directly. But I consider this as a bug because it clearly forces me to put all the data in array before setting value prop. This is also invalid because one could simply doesn't have all the data pages in that array (imagine initially I have only first data page and then I click and load for example 5th data page).

Reproducer

-

PrimeVue version

4.0.4

Vue version

4.x

Language

TypeScript

Build / Runtime

Vue CLI App

Browser(s)

Chromium

Steps to reproduce the behavior

No response

Expected behavior

No response

tugcekucukoglu commented 2 weeks ago

Could you share a stackblitz demo? We want to check what we can do.