I have a table with four columns and it looks like this:
I am populating the table using a Javascript array which is like this:
$scope.result = [
[5, 3/2/2016, 4, 'Bla..bla'],
[2, 1/4/2016, 3, 'bla..bla.bla'],
[1, 5/6/2016, 6, 'bla'],
[4, 2/6/2016, 5, 'blablabla'],
[3, 3/4/2016, 4, 'bla'],
[2, 2/4/2016, 5, 'bla'],
[1, 2/3/2016, 6, 'blablabla'] ];
And this is my HTML:
<table class="dataTable" border="1" >
<tr>
<td>Number</td>
<td>Date</td>
<td>Time</td>
<td>Description</td>
</tr>
<tr ng-repeat="row in result">
<td ng-repeat="item in row">{{ item }}</td>
</tr>
</table>
Now I have four buttons each one with the name of column name.
<span>
<button>Number</button>
<button>Date</button>
<button>Time</button>
<button>Description</button>
</span>
When any of those buttons is clicked, I want to show/hide that column.
So if I click on Description button, I want to show/hide the Description column.
I tried using ng-hide but couldn't get the entire column to hide, it would only hide the first table cell. So how do I do that?
Thanks :)
