diff --git a/Mvc.JQuery.DataTables.Common/DataTableConfigVm.cs b/Mvc.JQuery.DataTables.Common/DataTableConfigVm.cs index c0d59d5..3c04cdb 100644 --- a/Mvc.JQuery.DataTables.Common/DataTableConfigVm.cs +++ b/Mvc.JQuery.DataTables.Common/DataTableConfigVm.cs @@ -68,6 +68,8 @@ public string ColumnDefsString public bool TableTools { get; set; } + public bool Buttons { get; set; } + public bool AutoWidth { get; set; } public JToken SearchCols @@ -96,6 +98,8 @@ public string Dom str += "C"; if (this.TableTools) str += "T<\"clear\">"; + if (this.Buttons) + str += "B"; if (this.ShowPageSizes) str += "l"; if (this.ShowFilterInput) diff --git a/Mvc.JQuery.DataTables.Tests/packages.config b/Mvc.JQuery.DataTables.Tests/packages.config index b0f990c..0e107f7 100644 --- a/Mvc.JQuery.DataTables.Tests/packages.config +++ b/Mvc.JQuery.DataTables.Tests/packages.config @@ -7,5 +7,6 @@ - + + \ No newline at end of file diff --git a/Mvc.JQuery.Datatables.Example/Controllers/HomeController.cs b/Mvc.JQuery.Datatables.Example/Controllers/HomeController.cs index 4aadddd..bff8b03 100644 --- a/Mvc.JQuery.Datatables.Example/Controllers/HomeController.cs +++ b/Mvc.JQuery.Datatables.Example/Controllers/HomeController.cs @@ -48,6 +48,8 @@ public ActionResult Index() vm.ColVis = true; vm.ShowVisibleColumnPicker = true; //Displays a control for showing/hiding columns + //Enable Buttons + vm.Buttons = true; //Localizable if (Request.QueryString["lang"] == "de") diff --git a/Mvc.JQuery.Datatables.Example/Views/Home/Index.cshtml b/Mvc.JQuery.Datatables.Example/Views/Home/Index.cshtml index 8e9c556..8769721 100644 --- a/Mvc.JQuery.Datatables.Example/Views/Home/Index.cshtml +++ b/Mvc.JQuery.Datatables.Example/Views/Home/Index.cshtml @@ -39,7 +39,7 @@ public class SomeController : Controller

and render the partial (see example) -

+                                
         //include these scripts to use standard features
         <script type="text/javascript" src="//cdn.datatables.net/1.10.0/js/jquery.dataTables.js"></script>
         <link rel="stylesheet" href="//cdn.datatables.net/1.10.0/css/jquery.dataTables.css" />
@@ -51,7 +51,7 @@ public class SomeController : Controller
         <script type="text/javascript" src="/Content/jquery-datatables-column-filter/jquery-ui-timepicker-addon.js"></script>
         <link rel="stylesheet" href="/Content/jquery-datatables-column-filter/jquery-ui-timepicker-addon.css" />
         
-        //and these if you want to use  TableTools (export buttons)
+        //and these if you want to use  TableTools (export buttons, deprecated with Flash). Use Buttons for new version.
         <script type="text/javascript" src="//cdn.datatables.net/tabletools/2.2.1/js/dataTables.tableTools.min.js"></script>
         <link rel="stylesheet" href="//cdn.datatables.net/tabletools/2.2.1/css/dataTables.tableTools.css" />
         
@@ -59,6 +59,16 @@ public class SomeController : Controller
         <link rel="stylesheet" href="//cdn.datatables.net/colvis/1.1.1/css/dataTables.colVis.css" />
         <script type="text/javascript" src="//cdn.datatables.net/colvis/1.1.1/js/dataTables.colVis.min.js"></script>
         
+        //And these if you need buttons, note the button colVis is included 
+        <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.7.1/css/buttons.dataTables.min.css" />
+        <script type="text/javascript" src="https://cdn.datatables.net/buttons/1.7.1/js/dataTables.buttons.min.js"></script>
+        <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jszip/2.5.0/jszip.min.js"></script>
+        <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/pdfmake.min.js"></script>
+        <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js"></script>
+        <script type="text/javascript" src="https://cdn.datatables.net/buttons/1.7.1/js/buttons.colVis.min.js"></script>
+        <script type="text/javascript" src="https://cdn.datatables.net/buttons/1.7.1/js/buttons.html5.min.js"></script>
+        <script type="text/javascript" src="https://cdn.datatables.net/buttons/1.7.1/js/buttons.print.min.js"></script>
+
         var dataTablesConfigVm = dataTablesConfigVmHtml.DataTableVm("table-id", (HomeController h) => h.GetUsers(null))
         //set options on the config here, see example here
 
diff --git a/Mvc.JQuery.Datatables.Example/Views/Home/_ExampleTable.cshtml b/Mvc.JQuery.Datatables.Example/Views/Home/_ExampleTable.cshtml
index 794aeb0..d980338 100644
--- a/Mvc.JQuery.Datatables.Example/Views/Home/_ExampleTable.cshtml
+++ b/Mvc.JQuery.Datatables.Example/Views/Home/_ExampleTable.cshtml
@@ -10,8 +10,6 @@
 
 
 
-
-
 
 
 
@@ -22,11 +20,21 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
 @{
 
     //var vm = Html.DataTableVm("table-id", (HomeController h) => h.GetUsers(null));
     var vm = Model;
-  
+
 }