Override xls button using fnClick
Override xls button using fnClick
excorsa
Posts: 1Questions: 0Answers: 0
Hello All.
I'm working in MVC 3 and the interaction they need is a preview of the data in the view: 3 columns and 5 rows. Now what I'd like to do is override the xls button so that it calls a action that dumps the entire data collection to a csv file. Data will be thousands of rows and 37 columns. Here is my initializing script:
[code]
$('#CasesTable').dataTable({
"aoColumnDefs": [
{
"bVisible": true, "aTargets": [0, 1, 2]
},
{
"bSortable": true, "aTargets": [0]
}
],
"sDom": "<'row-fluid'<'span6'T><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
"bFilter": false,
"bPaginate": true,
"oLanguage": {
"oPaginate": {
"sFirst": "",
"sPrevious": "",
"sNext": "",
"sLast": ""
}
},
'iDisplayLength': 5,
"oTableTools": {
"sSwfPath": $("#swfPath").val(),
"aButtons": [
{
"sExtends": "xls",
"sButtonText": "Save to Excel",
"fnClick": function () { alert("Hi There Purple Pig");}
}
]
}
});
[/code]
So what happens is the alert fires along with the save as dialog. How do I accomplish just the alert and not the save?
All this came to be because the page originally had a table that was several thousand rows and 37 columns. the aoColumnDefs was originally hiding all the columns but three...it was really really slow for some reason.
Any help will be greatly appreciated.
Sincerely,
Excorsa
I'm working in MVC 3 and the interaction they need is a preview of the data in the view: 3 columns and 5 rows. Now what I'd like to do is override the xls button so that it calls a action that dumps the entire data collection to a csv file. Data will be thousands of rows and 37 columns. Here is my initializing script:
[code]
$('#CasesTable').dataTable({
"aoColumnDefs": [
{
"bVisible": true, "aTargets": [0, 1, 2]
},
{
"bSortable": true, "aTargets": [0]
}
],
"sDom": "<'row-fluid'<'span6'T><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
"bFilter": false,
"bPaginate": true,
"oLanguage": {
"oPaginate": {
"sFirst": "",
"sPrevious": "",
"sNext": "",
"sLast": ""
}
},
'iDisplayLength': 5,
"oTableTools": {
"sSwfPath": $("#swfPath").val(),
"aButtons": [
{
"sExtends": "xls",
"sButtonText": "Save to Excel",
"fnClick": function () { alert("Hi There Purple Pig");}
}
]
}
});
[/code]
So what happens is the alert fires along with the save as dialog. How do I accomplish just the alert and not the save?
All this came to be because the page originally had a table that was several thousand rows and 37 columns. the aoColumnDefs was originally hiding all the columns but three...it was really really slow for some reason.
Any help will be greatly appreciated.
Sincerely,
Excorsa
This discussion has been closed.