Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

974
Visualizações
v-for loop throws Uncaught TypeError: row.children.default is not a function

I'm using Vue3 with PrimeVue and want to create dynamic table header sections based on a config file. I modified the sample code from the docs for column groups https://primefaces.org/primevue/showcase/#/datatable/colgroup .

When hardcoding headers everything is fine

<template>
  <div id="app">
    <p-data-table>
      <p-column-group type="header">
        <p-row>
          <p-column header="Section 1" :rowspan="4" :colspan="1" />
          <p-column header="Section 2" :rowspan="1" :colspan="2" />
          <p-column header="Section 3" :rowspan="1" :colspan="3" />
          <p-column header="Section 4" :rowspan="1" :colspan="1" />
        </p-row>
        <p-row>
          <p-column header="Section 2.1" :rowspan="3" :colspan="1" />
          <p-column header="Section 2.2" :rowspan="3" :colspan="1" />
          <p-column header="Section 3.1" :rowspan="3" :colspan="1" />
          <p-column header="Section 3.2" :rowspan="1" :colspan="2" />
          <p-column header="Section 4.1" :rowspan="1" :colspan="1" />
        </p-row>
        <p-row>
          <p-column header="Section 3.2.1" :rowspan="2" :colspan="1" />
          <p-column header="Section 3.2.2" :rowspan="2" :colspan="1" />
          <p-column header="Section 4.1.1" :rowspan="1" :colspan="1" />
        </p-row>
        <p-row>
          <p-column header="Section 4.1.1.1" :rowspan="1" :colspan="1" />
        </p-row>
      </p-column-group>
    </p-data-table>
  </div>
</template>

<script lang="ts">
import { defineComponent, ref } from "vue";
import DataTable from "primevue/datatable";
import Column from "primevue/column";
import Row from "primevue/row";
import ColumnGroup from "primevue/columngroup";

export default defineComponent({
  components: {
    "p-data-table": DataTable,
    "p-column": Column,
    "p-row": Row,
    "p-column-group": ColumnGroup,
  }
});
</script>

The generated output is as expected

enter image description here

You can see the working live demo here

When trying to load the hardcoded headers from code like so

<template>
  <div id="app">
    <p-data-table>
      <p-column-group type="header">
        <p-row
          v-for="(columnHeaderRow, columnHeaderRowIndex) in columnHeaderRows"
          :key="`columnHeaderRow-${columnHeaderRowIndex}`"
        >
          <p-column
            v-for="(columnHeader, columnHeaderIndex) in columnHeaderRow"
            :key="`columnHeader-${columnHeaderIndex}`"
            :header="columnHeader.header"
            :rowspan="columnHeader.rowspan"
            :colspan="columnHeader.colspan"
          />
        </p-row>
      </p-column-group>
    </p-data-table>
  </div>
</template>

<script lang="ts">
import { defineComponent, ref } from "vue";
import DataTable from "primevue/datatable";
import Column from "primevue/column";
import Row from "primevue/row";
import ColumnGroup from "primevue/columngroup";

export default defineComponent({
  components: {
    "p-data-table": DataTable,
    "p-column": Column,
    "p-row": Row,
    "p-column-group": ColumnGroup,
  },
  setup() {
    const columnHeaderRows = ref([
      [
        { header: "Section 1", rowspan: "4", colspan: "1" },
        { header: "Section 2", rowspan: "1", colspan: "2" },
        { header: "Section 3", rowspan: "1", colspan: "3" },
        { header: "Section 4", rowspan: "1", colspan: "1" },
      ],
      [
        { header: "Section 2.1", rowspan: "3", colspan: "1" },
        { header: "Section 2.2", rowspan: "3", colspan: "1" },
        { header: "Section 3.1", rowspan: "3", colspan: "1" },
        { header: "Section 3.2", rowspan: "1", colspan: "2" },
        { header: "Section 4.1", rowspan: "1", colspan: "1" },
      ],
      [
        { header: "Section 3.2.1", rowspan: "2", colspan: "1" },
        { header: "Section 3.2.2", rowspan: "2", colspan: "1" },
        { header: "Section 4.1.1", rowspan: "1", colspan: "1" },
      ],
      [{ header: "Section 4.1.1.1", rowspan: "1", colspan: "1" }],
    ]);

    return { columnHeaderRows };
  },
});
</script>

I get the following error

Uncaught TypeError: row.children.default is not a function

enter image description here

You can see the demo showing the error here

Does someone know what's wrong and how to fix it?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Ok this is a known bug https://github.com/primefaces/primevue/issues/1630

and already fixed on master https://github.com/primefaces/primevue/commit/a51f26ce40ae4dc6df35a457f13a2d400604410a

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda