asp.net mvc 4 - Table tools on jquery datatable ? Minor issue -


well been working on exporting datatable data . tried below link mentioned code in case getting nothing . link : http://datatables.net/extras/tabletools/

my code :

  $(document).ready(function () {          $("#btnguru").click(function () {             tabletoexcel('mydatatable', 'w3c example table');         });          $.datepicker.regional[""].dateformat = 'dd/mm/yy';         $.datepicker.setdefaults($.datepicker.regional['']);         debugger;         var dt = $('#mydatatable').datatable({              "sdom": 't<"h"plfr>t<"f"ip>',             "otabletools": {                 "abuttons": [ "csv", "pdf" ],                 "sswfpath": "https://datatables.net/release-datatables/extras/tabletools/media/swf/copy_csv_xls_pdf.swf"             },               "bprocessing": true,             "bserverside": true,             "sajaxsource": "home/ajaxhandler",             "bjqueryui": true,             "aocolumns": [                                     {                                         "sname": "lead_id",                                         "bvisible": false,                                         "bsearchable": false,                                         "bsortable": false                                     },                        {                            "sname": "contact_name"  ,                            "bsearchable": false,                            "bsortable": false,                            "fnrender": function (oobj) {                                return '<a href=\"home/details/' + oobj.adata[0] + '\">' + oobj.adata[1] + '</a>';                            }                        },                        { "sname": "contact_address" },                        { "sname": "lead_source" },                        { "sname": "domain" }             ]          }); 

regards

it highly recommended have "sswfpath" files in local directory inside project. suggest download them. also, believe "sdom" should different (check link have posted yourself).

my suggestion initialize "sdom" along table , initialize table tools later on. last not least, add local source swf in end.

var dt = $('#mydatatable').datatable({                 "dom": 't<"clear">lfrtip',                 "bprocessing": true,         "bserverside": true,         "sajaxsource": "home/ajaxhandler",         "bjqueryui": true,         "aocolumns": [                                 {                                     "sname": "lead_id",                                     "bvisible": false,                                     "bsearchable": false,                                     "bsortable": false                                 },                    {                        "sname": "contact_name"  ,                        "bsearchable": false,                        "bsortable": false,                        "fnrender": function (oobj) {                            return '<a href=\"home/details/' + oobj.adata[0] + '\">' + oobj.adata[1] + '</a>';                        }                    },                    { "sname": "contact_address" },                    { "sname": "lead_source" },                    { "sname": "domain" }         ]      });  tabletools.defaults.abuttons = [ "csv", "pdf" ]; tabletools.defaults.sswfpath = path here! // way did //tabletools.defaults.sswfpath = "<?php echo $this->basepath() ?>/swf/copy_csv_xls_pdf.swf"; 

try out.


Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -