You need to sign in to do that
Don't have an account?
VVH
how to remove column from data table in lwc
I'm trying to remove a column in lwc when certain condition is met. Is there any attribute or something from which i can make the visiblity of column true/false.
@track hideCoulmn;
@track columns = [
{
label: "column1",
hideDefaultActions: "true",
editable: false,
sortable: false },
{
label: "column2",
fieldName: "culomn2___c",
type: "text",
hideDefaultActions: "true",
editable: false,
sortable: false,
//needs to be hidden when hideColumn=true
},
so can i have @track property called @track hideCoulmn and make it true/false whenever i need and by that hide the column? is it possible?
@track hideCoulmn;
@track columns = [
{
label: "column1",
hideDefaultActions: "true",
editable: false,
sortable: false },
{
label: "column2",
fieldName: "culomn2___c",
type: "text",
hideDefaultActions: "true",
editable: false,
sortable: false,
//needs to be hidden when hideColumn=true
},
so can i have @track property called @track hideCoulmn and make it true/false whenever i need and by that hide the column? is it possible?
tableHeader = true;
use hide-table-header={tableHeader} and hide/show your table header. this property is boolean
don't forget to mark it as best answer.
Thank you
Thanks for the reply, maybe i wasnt clear before
I want to hide only the second column. hide-table-header will hide all the colums but i want to hide only the column2. so is it possible to acieve it?