Skip to content

Commit 6bc9d48

Browse files
committed
Addded colvis
1 parent 82551ec commit 6bc9d48

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

Mvc.JQuery.Datatables.Example/Views/Home/_ExampleTable.cshtml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212

1313
<script type="text/javascript" src="/Content/jquery.dataTables.columnFilter.js"></script>
1414

15-
15+
<link rel="stylesheet" href="//cdn.datatables.net/colvis/1.1.1/css/dataTables.colVis.css" />
16+
<script type="text/javascript" src="//cdn.datatables.net/colvis/1.1.1/js/dataTables.colVis.min.js"></script>
1617

1718
@{
1819
var vm = Html.DataTableVm("table-id", (HomeController h) => h.GetUsers(null));

Mvc.JQuery.Datatables/DataTableConfigVm.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ public string Dom
8080
{
8181
get {
8282
var sdom = "";
83+
if (ColVis) sdom += "C";
8384
if (TableTools) sdom += "T<\"clear\">";
8485
if (ShowPageSizes) sdom += "l";
8586
if (ShowSearch) sdom += "f";
@@ -88,6 +89,8 @@ public string Dom
8889
}
8990
}
9091

92+
public bool ColVis { get; set; }
93+
9194
public string ColumnSortingString
9295
{
9396
get

Mvc.JQuery.Datatables/Models/ColDef.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ protected internal ColDef(string name, Type type)
1717
MRenderFunction = (string) null;
1818
CssClass = "";
1919
CssClassHeader = "";
20+
this.Searchable = true;
2021
}
2122

2223
public string Name { get; set; }

0 commit comments

Comments
 (0)