DataTable with Tabs from Primevue not showing any data?

I have in vuejs a DataTable in a component that I display using Tabs. This means that one DataTable is always visible and the others only after clicking on the next Tab. When the page reloads, the data of only the enabled tab is visible, but if I switch to the second Tab, only the header of the DataTable is displayed, but not the data. If I resize the browser/tab window, the data is displayed. This behavior started after I added the :virtualScrollerOptions property. Before adding this, everything was fine, but very slow. Does anyone know where the problem is?

I searched but there was no solution anywhere

New contributor

Holec Pavel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

2

I’ll try Stackblitz, but it can be difficult to parse out only what’s important and can go out.

In the meantime, I’ll try sending a piece of code to see if that helps.

....

onMounted(() => {
  window.addEventListener('resize', updateWindowHeight);
});

onBeforeUnmount(() => {
  window.removeEventListener('resize', updateWindowHeight);
});

</script>

<template>
  <info-panel />
  <p class="card mycard">
    <Tabs :value="selectedTab" scrollable @update:value="change">
      <TabList>
        <Tab :class="tabClasses" v-for="tab in tabs" :key="tab.title" :value="tab.value">
          {{ tab.title }}
        </Tab>
      </TabList>
      <TabPanels style="padding-left:0px; padding-top:6px; padding-bottom:0px; padding-right:0px">
        <TabPanel v-for="tab in tabs" :key="tab.title" :value="tab.value">
          <p class="m-0">
            <CustomersList v-model:tabIndex="tab.value" :windowHeight="windowHeight" />
          </p>
        </TabPanel>
      </TabPanels>
    </Tabs>
  </p>

</template>

and in component CustomersList is:

....

onBeforeMount(() => {
  const username = localStorage.getItem('username');
  loading.value = true; // calling 4 times (every tab)
  ApiPost('get-firms', {what_firms: tabIndex.value, username: username}).then((data) => (customers.value = data, loading.value = false));  
})

</script>

<template>

  <div v-if="loading">
    <Skeleton v-for="n in skeletonCount" :key="n" class = "mt-3" :height="skeletonHeight + 'px'" />
  </div>

  <DataTable v-else v-on:filter="onFilter" v-model:filters="filters" :value="customers" removableSort scrollable :scrollHeight="windowHeight + 'px'" v-model:selection="selectedCustomer" selectionMode="single" contextMenu v-model:contextMenuSelection="selectedCustomer" filterDisplay="row"
          @rowContextmenu="onRowContextMenu" @rowUnselect="onRowUnselect" @row-dblclick="onRowDoubleClick" tableStyle="min-width: 50rem" :metaKeySelection="true"
          :virtualScrollerOptions="{ itemSize: 30 }" stateStorage="local" :stateKey="'dt-state-v01-' + tabIndex" >

    <Column field="f_name" header="Citty" sortable frozen class="font-bold">
      <template #body="{ field, data }">
        <div :class="'text-gray-500 dark:text-gray-300'">
          <div class="column-name"> {{ data[field] }} </div>
        </div>
      </template>
      <template #filter="{ filterModel, filterCallback }">
        <InputText v-model="filterModel.value" type="text" @input="filterCallback()" placeholder="look" class="column-name" />
      </template>
    </Column>
....

virtualScrollerOptions is causing an error. I even found that when I scroll through the list, some items are skipped – the list jumps further

New contributor

Holec Pavel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật