dataTables.tableTools.min.js

dataTables.tableTools.min.js

ccvallecanoccvallecano Posts: 4Questions: 2Answers: 0
edited March 2016 in Free community support

Hello all
I am beginner in data table and I'm doing a project mvc
my problem is trying to export to excel, pdf etc
I am using the example of bootstrap for asp.net mvc, but I can not do

This is my code in _Layout.cshtml

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>-4.0</title>
    
    <link href="~/Content/DataTables/css/dataTables.bootstrap.css" rel="stylesheet" />
    <link href="~/Content/DataTables/css/jquery.dataTables.css" rel="stylesheet" />
    <link href="~/Content/DataTables/css/dataTables.colReorder.css" rel="stylesheet" />
    <link rel="stylesheet" type="text/css" href="~/Content/DataTables/css/dataTables.colVis.css">
    <link rel="stylesheet" type="text/css" href="//cdn.datatables.net/tabletools/2.2.1/css/dataTables.tableTools.css">
    <!-- Bootstrap -->
    <link href="@Url.Content("/css/bootstrap.css")" rel="stylesheet">
    <link href="@Url.Content("/css/modern-business.css")" rel="stylesheet">
       
      <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>    
        <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
            <div class="container">


                <div class="navbar-header">
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>

                    <ul class="nav navbar-nav navbar-right" style="align-content:inherit ">
                        <li id="Logo" style=" width :100px">
                            <img style=" width :80px;height :45px " src="~/Content/images/logo_t.png" />
                        </li>
                        <li id="CIndex">
                            @Html.ActionLink("    - 4.0 ", "Index", new { controller = "Home" }, new { @class = "navbar-brand" })
                        </li>
                    </ul> .......

and this is my code in Index.cshtml

......


@section scripts{
    <script type="text/javascript" language="javascript" src="~/Scripts/DataTables/jquery.dataTables.min.js"></script>
    <script type="text/javascript" language="javascript" src="~/Scripts/DataTables/dataTables.bootstrap.js"></script>
    <script type="text/javascript" language="javascript" src="~/Scripts/DataTables/dataTables.colReorder.min.js"></script>
    <script type="text/javascript" language="javascript" src="~/Scripts/DataTables/dataTables.colVis.min.js"></script>
    <script type="text/javascript" language="javascript" src="~/Scripts/DataTables/dataTables.tableTools.min.js"></script>
    <script type="text/javascript">
  $(document).ready(function () {
      var table = $('.table').dataTable();
      var tt = new $.fn.dataTable.TableTools(table);
      $(tt.fnContainer()).insertBefore('div.dataTables_wrapper');
  });
    </script>
 
}

It works well order functions to datatable but does not export

Juan

Answers

  • jr42.gordonjr42.gordon Posts: 305Questions: 2Answers: 49

    Instead of using TableTools directly, download the latest version of DataTables and include the Button extension. It is much easier to use.

    https://datatables.net/extensions/buttons/

  • allanallan Posts: 61,663Questions: 1Answers: 10,095 Site admin

    Yup - TableTools is retired software and is no longer actively developed. Buttons is its replacement. If you have problems setting it up, please link to a test case showing the issue, as per the forum rules.

    Allan

  • ccvallecanoccvallecano Posts: 4Questions: 2Answers: 0

    Thank you so much

This discussion has been closed.