DataTable hide-columns

  • Sometimes we want to hide just one or two columns (e.g. the id column).
    Would it make sense to also have a hide-columns vue property?

  • You have the visible-columns property which is basically the same but with inverted logic.
    If you want to just hide one or two, use a filter. Imagine that documents is an array containing the documents that you want to show, and that you want to hide the __index property:

        data () {
            const documents = this.documents
            return {
                page: 1,
                filter: '',
                columns: Object.keys(documents[0]).map(makeCol()),
                visibleColumns: Object.keys(documents[0]).filter(i => i !== '__index')

Log in to reply