jquery - how to export table with first and last column excluding.? -


i have many display file many table, want export file in excel, doc , png type. in table first column profile_pic & last column have option or action. dont want export column each file.

my each table different count of column. how exclude column each file. got solution 1 file of table want multiple table.

following code:

<script type="text/javascript" src="js/jquery-1.8.3.js"></script>      <script type="text/javascript" src="js/tableexportpatient.js"></script>  <script type="text/javascript" src="js/jquery.base64.js"></script>
	<button class="btn"><i class="fa fa-bars"></i> export table data</button>  			<ul class='id_ul'>  				<li><a href="#" onclick ="$('#datawtable').tableexport({type:'excel',escape:'false'});"> <img src='icons/xls.png' width='24px'> xls</a></li>  				<li><a href="#" onclick ="$('#datawtable').tableexport({type:'doc',escape:'false'});"> <img src='icons/word.png' width='24px'> word</a></li>  				<li><a href="#" onclick ="$('#datawtable').tableexport({type:'png',escape:'false'});"> <img src='icons/png.png' width='24px'> png</a></li>   			</ul>

just use ignorecolumn option, e.g.

$('#datawtable').tableexport({     type:'excel',     escape:'false',     ignorecolumn: [2,3] // <--- here }); 

where 2,3 columns exclude.

to index of last column dynamically smth like

var lastindex = $('#datawtable').find("tr").first().find("td").last().index(); 

or even

var lastindex = $('#datawtable tr:nth-child(1) td:last').index(); 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -