Adding row selection
Adding row selection
Hi,
I'm trying to get row selection to work in my data table.
http://datatables.net/release-datatables/extensions/TableTools/examples/select_multi.html
Right now I have this code working so that it only searches 1 column,
$('#example').dataTable({
"columnDefs": [
{ "searchable": false, "targets": 2 }]});
} );
But I want to add this for row selection. Eventually I'm hoping to be able to save the selection out to a pdf, but right now I'm just focusing on selecting things.
$('#example').DataTable( {
dom: 'T<"clear">lfrtip',
tableTools: {
"sRowSelect": "multi",
"aButtons": [ "select_all", "select_none" ]
}
} );
} );
I keep getting an error,
DataTables warning: table id=example - Cannot reinitialise DataTable. For more information about this error, please see http://datatables.net/tn/3
I tried single initialisation but then it just breaks my datatable. :(
$(document).ready(function() {
$('#example').dataTable({
"columnDefs": [
{ "searchable": false, "targets": 2 }]
dom: 'T<"clear">lfrtip',
tableTools: {
"sRowSelect": "multi",
"aButtons": [ "select_all", "select_none" ]
}
} );
} );
I know there's probably something very simple that I'm missing, but I can't figure it out. If anyone could help it would be greatly appreciated.
Answers
Ok, I got row selection working, but only by removing the column searchable code, which I still need.
I've managed to get multi row selection working with a save button for pdf and xls, but nothing happens when i click save
This is what I have right now,
} );
any suggestions?
sigh I think I found my problem for not being able to save pdf. I tried the original example and it doesn't seem to work on a local machine. This site will never be online and is only for internal use in the office.
found this answer in the forums :(:(
"It won't work from a local drive, unless you have a security exception set up for Flash. This is a Flash security setting, and there is no way for me to get around it I'm afraid. You can change the security settings here: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html .
A better solution is just to dump the files onto a web-server."
Unfortunately I can't put this on a web-server, and there's no way the office will allow me to change the security settings.
I now tried uploading the swf file to free web hosting site and linking my swfpath to it from my local site. But no luck. :( No errors or anything it just doesn't want to work.