Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Mvc.JQuery.Datatables.Example/Views/Home/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class SomeController : Controller
.FilterOn("Id").NumberRange();
//.FilterOn("Number").CheckBoxes(Enum.GetNames(typeof(Numbers)));
vm.StateSave = true;

//vm.DrawCallback = "drawCallback";

if (Request.QueryString["lang"] == "de")
{
Expand Down Expand Up @@ -91,6 +91,11 @@ public class SomeController : Controller
function test(data, type, full) {
return '<i>' + data + '</i>';
}

function drawCallback(oSettings) {
console.log('fnDrawCallback fired');
console.log(oSettings);
}
</script>
@Html.Partial("DataTable", vm)

Expand Down
19 changes: 12 additions & 7 deletions Mvc.JQuery.Datatables.Templates/Views/Shared/DataTable.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,23 @@
{
<text>
,"oLanguage": @Html.Raw(@Model.Language)

</text>
}
@if (!string.IsNullOrEmpty(Model.DrawCallback))
{
<text>
,"fnDrawCallback": @Html.Raw(Model.DrawCallback)
</text>
}
});
@if (Model.ColumnFilter)
{
<text>
dt.columnFilter({
sPlaceHolder: "head:before",
aoColumns: [@Html.Raw(Model.ColumnFiltersString)]
});
</text>
<text>
dt.columnFilter({
sPlaceHolder: "head:before",
aoColumns: [@Html.Raw(Model.ColumnFiltersString)]
});
</text>
}
})();
</script>
2 changes: 2 additions & 0 deletions Mvc.JQuery.Datatables/DataTableConfigVm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ public string ColumnSortingString

public string Language { get; set; }

public string DrawCallback { get; set; }

public string GetFilterType(string columnName, Type type)
{
foreach (Func<string, Type, string> filterTypeRule in FilterTypeRules)
Expand Down