I have a big table of info which can get a bit overwhelming. I currently have buttons to hide or show certain columns to make it easier to find what you need. I use this code to show/hide.
<script type="text/javascript" charset="utf-8">
function fnShowHide( iCol )
{
var oTable = $('#tablename').dataTable();
var bVis = oTable.fnSettings().aoColumns[iCol].bVisible;
oTable.fnSetColumnVis( iCol, bVis ? false : true );
}
</script>
Later on, I use the following code to hide or show a certain column in the table.
<button id="button">
<a href="javascript:void(0);" onclick="fnShowHide(0);">Column1</a>
</button>
<button id="button">
<a href="javascript:void(0);" onclick="fnShowHide(1);">Column2</a>
</button>
<button id="button">
<a href="javascript:void(0);" onclick="fnShowHide(2);">Column3</a>
</button>
How would I make a single button that would hide or show multiple rows rather than just single rows?
I am using DataTables to show my data and am using this example for the button above (if that makes a difference).