create dynamics headers in v-data-table with vue js 2

create dynamics headers in v-data-table with vue js 2


0

I´m traying to do that my header in one column of my table be dynamic. i´m working with vue js 2.

i have this object to statics headers:

    headers: [
              { text: 'Nombre', value: 'nombre' },
              { text: 'Tipo de grupo', value: 'tipoGrupo' },
              { text: 'Actividad', value: 'tipoLiquidacion' },
              { text: 'Número de empresas', value: 'numeroEmpresas' },
              { text: `Empresas con ${getAgrupacionTipo}`, value: 'numeroEmpresasConLiquidacion' },
              { text: 'Empresas sin liquidación', value: 'numeroEmpresasSinLiquidar' },
              { text: 'Total', value: 'totalSaldos', align: 'center' },
              { text: 'Fecha poblado', value: 'fecha_poblado' },
              { text: 'Fecha calculado', value: 'fecha_calculado' },
              { text: 'Estado', value: 'estado', align: 'center' },
  ],

i have my property agrupacionTipo: { type: Array }, and i have a computed function to return value.

getAgrupacionTipo: function () {
   return this.agrupacionTipo[0];
}

My data from API it´s received from graphql and my data it´s:

{…}
agrupacionTipoLiquidacion: Object
nombre: "Liquidaciones"
__typename: (...)
__ob__: Observer {value: {…}, shallow: false, mock: false, dep: Dep, vmCount: 0}
get nombre: 
ƒ reactiveGetter()set nombre: 
ƒ reactiveSetter(newVal)get __typename: 
ƒ reactiveGetter()set __typename: 
ƒ reactiveSetter(newVal)[[Prototype]]: 
Object agrupacionTipoLiquidacion_id:(...)
id: (...)
nombre: (...)
__typename: (...)

i need get data from agrupacionTipoLiquidacion: Object that contain name this name i need set in { text: Empresas con ${getAgrupacionTipo}, value: 'numeroEmpresasConLiquidacion' }, dynamically

But now i´m returning to web browser console: [Vue warn]: Error in data(): "ReferenceError: getAgrupacionTipo is not defined"

Thanks for readme and sorry for my bad english

Share


Load 7 more related questions


Show fewer related questions

0

Reset to default



Browse other questions tagged

or ask your own question.

Leave a Reply

Your email address will not be published. Required fields are marked *