Hiding columns (and re-activating)

Hello guys,

I am trying to hide / show columns via coding depending on filters:

	case TASK_FILTER.WORKEDON:
		elements.btnNew.addStyleClass('bg-info');
		elements.table.columns.forEach(function(column) {
			if (column.id == "taskstartdate") {
				column.visible = false;
			 //|| column.dataprovider == "taskenddate") {
			} else if (column.dataprovider == "totalTimeregFormatted") {
				column.visible = true;				
			}
		});	
		break;

This works perfectly until… I hide more than 2 columns. Only one column is then showing again when setting them to visible = true.
The columns are stil available in the code but will not show anymore.
Tried several things even hard coding the column number via elements.table.columns[1].visible all with the same result.

Any ideas?