Issue with Hide/show columns

Issue with Hide/show columns

ssuram@dstws.comssuram@dstws.com Posts: 2Questions: 1Answers: 0

I am using datatables with angular 4 with an extension angular-datatables where in I provide datatable options in init method. Onchange in a dropdown I want show/hide certain columns. It is working for the first time but from second time the property is getting changed when I console it I can see, but it is not reflecting on the table by hiding/showing the respective column.

if (searchTypeCategory === "appOwner") {
this.dtOptions.columns[4].visible = false;
this.dtOptions.columns[3].visible = true;
}

where as
this.dtOptions = {
pagingType: 'simple_numbers',
pageLength: 10,
info: false,
lengthChange: false,
searching: false,
columns: [{
{
title: "Application Status",
data: 'applicationStatus'
},
{....}
]
};

This discussion has been closed.