Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82266

fnSetColumnVis deletes data ?

$
0
0
function toggleIt() {
	var indices = [];
	$("#myTable tbody tr").first().children("td.myclass").each(function(){
		indices.push($(this).index());
	});
	alert("indices:" + indices);
	for(var ind in indices)
	{
		var iCol = indices[ind];
		var bVis = oTable.fnSettings().aoColumns[iCol].bVisible;
		oTable.fnSetColumnVis( iCol, bVis ? false : true );
	}
}

When I run toggleIt(), I get
"indices: 4,6,7"
inside alert dialog box. Then 4,6 and 7th columns are hidden.
When I run toggleIt() again I get an empty indices array.

When I check DOM, I see that 4,6 and 7th columns are deleted.
Does "fnSetColumnVis" deletes the columns? Is it possible to just hide rather than delete the data?

Viewing all articles
Browse latest Browse all 82266

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>