Skip to content

Commit 63dee01

Browse files
committed
Add global js variable option
1 parent d95f08f commit 63dee01

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Mvc.JQuery.Datatables.Templates/Views/Shared/DataTable.cshtml

+5
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,10 @@
8989
{
9090
@Html.Raw("dt.columnFilter(" + Model.ColumnFilterVm + ");")
9191
}
92+
93+
@if (Model.GlobalJsVariableName != null)
94+
{
95+
@Html.Raw("window['@Model.GlobalJsVariableName'] = dt;")
96+
}
9297
})();
9398
</script>

Mvc.JQuery.Datatables/DataTableConfigVm.cs

+1
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ public string ColumnSortingString
105105
public string DrawCallback { get; set; }
106106
public LengthMenuVm LengthMenu { get; set; }
107107
public int? PageLength { get; set; }
108+
public string GlobalJsVariableName { get; private set; }
108109

109110
private bool _columnFilter;
110111

0 commit comments

Comments
 (0)