Hi
I want to export my datatable data to excel or pdf . At any point when i click on my requirement means it should work so .
I goggled it but i was unable to find good articles which supposed to explain things in better prospective
CODE EDIT :
<script type="text/javascript">
$(document).ready(function () {
$("#btnExport").click(function(e) {
window.open('data:application/vnd.ms-excel,' + encodeURIComponent($('#myDataTable').html()));
e.preventDefault();
});
$.datepicker.regional[""].dateFormat = 'dd/mm/yy';
$.datepicker.setDefaults($.datepicker.regional['']);
var tab= $('#myDataTable').dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "Company/DataProvider",
"bJQueryUI": true,
"aoColumns": [
{
"sName": "ID"
},
{ "sName": "COMPANY_NAME" },
{ "sName": "ADDRESS" },
{ "sName": "TOWN" }
]
});
tab.makeEditable({
"aoColumns": [
null,
null,
null,
{
indicator: 'Saving...',
tooltip: 'Click to select town',
loadtext: 'loading...',
type: 'select',
onblur: 'submit',
loadurl: 'AjaxDataProvider1'
}]
});
});
</script>
}
<table id="myDataTable" class="display">
<thead>
<tr>
<th>ID</th>
<th>Company name</th>
<th>Address</th>
<th>Town</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<input type="button" id="btnExport" value="Export to Excel" />
Well i used one of the link and tried like this I dont why same way i tried in other system its showing me some columns in excel but now its simply throwing me error like:
CHROME : Showing just table headings thats it , columns not getting loaded
IE 10 : JavaScript critical error at line 47, column 12 in http://localhost:63553/Company/Index
SCRIPT1014: Invalid character
Thing is when i removed the piece of code i done for exporting to excel the data to table getting loaded successfully .
Hoping for better suggestions
Regards