HC200ok / vue3-easy-data-table

A customizable and easy-to-use data table component made with Vue.js 3.x
MIT License
536 stars 105 forks source link

Hide column #292

Open clabnet opened 1 year ago

clabnet commented 1 year ago

I have this columns :

  const headers: Header[] = ref([
    { text: 'NAME', value: 'name', sortable: true, fixed: true, width: 100 },
    { text: 'WEB', value: 'website', sortable: true },
    { text: 'LOGO', value: 'logo', sortable: true },
    { text: 'ACTION', value: 'action' },
  ])

I need to use also an ID field as value, but I don't would show it. It is required to address correct the action buttons. I have try using width = 0 but the ID field is rendered always. Any chance to add a column and hide it on grid ?

Thank's

scottMan1001 commented 1 year ago

seems like JQGrid , its colunms has an key called hidden , it will not show the header .
If some one could add this feature ,Thanks a alot

stolpeo commented 1 year ago

I would also be very interested in a "hide column" feature, something like

const tableHeaders = [
    { text: 'col 1', value: 'col1', sortable: true, hidden: true },
]

As a workaround, I generate the headers interactively, that works. Here is a rough sketch:

const optionalColumns = () => {
  return displayOptionalColumns.map(({ field, label }) => ({
    text: label,
    value: field,
    sortable: true,
  }))
}

const tableHeaders = computed(() => {
  return [
    { text: 'col 1', value: 'col1', sortable: true },
    { text: 'col 2', value: 'col2', sortable: true },
    ...optionalColumns(),
  ]
})

where the variable displayOptionalColumns is bound to a dropdown where one can select optional columns. Somehow casting a ref or reactive on the tableHeaders didn't work for me. HTH

pinheiroweb commented 10 months ago

I would also like to hide a grid column that is used as a key for events.

Thanks in advance !

imbraintl commented 4 months ago

I would also be very interested in a "hide column" feature, something like

hidden: true