Skip to content

Commit

Permalink
Added Option "StateSave"
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreiundzwanzig committed Oct 10, 2013
1 parent a8d756c commit c70f9c1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions Mvc.JQuery.Datatables.Example/Views/Home/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ can also use
vm.FilterOn("Position", new { sSelector = "#custom-filter-placeholder-position" }).Select("Engineer", "Tester", "Manager")
.FilterOn("Id").NumberRange();
//.FilterOn("Number").CheckBoxes(Enum.GetNames(typeof(Numbers)));
vm.StateSave = true;
}
@Html.Partial("DataTable", vm)

Expand Down
7 changes: 3 additions & 4 deletions Mvc.JQuery.Datatables.Templates/Views/Shared/DataTable.cshtml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
@using Mvc.JQuery.Datatables
@model DataTableConfigVm
@{

}

<table id="@Model.Id" class="display @(Model.TableClass ?? DataTableConfigVm.DefaultTableClass ?? "")" >
<thead>
<tr>
Expand All @@ -28,6 +26,7 @@
</tr>
</tbody>
</table>

<script type="text/javascript">
(function setDataTable() {
if(!window.jQuery) {
Expand All @@ -37,7 +36,7 @@
var $table = $('#@Model.Id');
var dt = $table.dataTable({
"bProcessing": true,
"bStateSave": true,
"bStateSave": @Html.Raw(Model.StateSave ? "true" : "false"),
"bServerSide": true,
"bFilter": @Model.ShowSearch.ToString().ToLower(),
"sDom": '@Html.Raw(Model.Dom)',
Expand Down
1 change: 1 addition & 0 deletions Mvc.JQuery.Datatables/DataTableConfigVm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public string Dom

public bool ShowPageSizes { get; set; }

public bool StateSave { get; set; }

public string GetFilterType(string columnName, Type type)
{
Expand Down

0 comments on commit c70f9c1

Please sign in to comment.