How to add hidden columns in the lightning data table? Thanks.
Is there anything I can add to typeAttributes/cellAttributes to make it invisible?
How to add hidden columns in the lightning data table? Thanks.
Is there anything I can add to typeAttributes/cellAttributes to make it invisible?
Expanding upon my comment.
The data storage that feeds your <lightning:dataTable>
can contain, and often does contain, elements you choose not to display. Your Apex server controller could, for example, query many fields that you need at some point during the front-end lifecycle, but which don't get shown in this particular table.
You might even annotate your data store with extra attributes that don't get displayed at all or which are only used indirectly in the data table. One thing I often do is add a URL field to my data table items:
cases.forEach(function(item) {
item['URL'] = '/lightning/r/Case/' + item['Id'] + '/view';
}
But that could just as easily be an internal status of some kind that your component uses to track its own state, and doesn't surface to the user.
To not display such a field, just don't list it in your <lightning:dataTable>
's columns
attribute. It'll be ignored.