Skip to content

Added Options "StateSave" and "Language" #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 10, 2013
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Added Option "Language", including config samples
  • Loading branch information
Dreiundzwanzig committed Oct 10, 2013
commit b671314a1fdf01adfcf8bd6a2ee5f02f38956b18
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"sProcessing": "Bitte warten...",
"sLengthMenu": "_MENU_ Einträge anzeigen",
"sZeroRecords": "Keine Einträge vorhanden.",
"sInfo": "_START_ bis _END_ von _TOTAL_ Einträgen",
"sInfoEmpty": "0 bis 0 von 0 Einträgen",
"sInfoFiltered": "(gefiltert von _MAX_ Einträgen)",
"sInfoPostFix": "",
"sSearch": "Suchen",
"sUrl": "",
"oPaginate": {
"sFirst": "Erster",
"sPrevious": "Zurück",
"sNext": "Weiter",
"sLast": "Letzter"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
<Content Include="Content\bootstrap.min.css" />
<Content Include="Content\images\glyphicons-halflings-white.png" />
<Content Include="Content\images\glyphicons-halflings.png" />
<Content Include="Content\jquery.dataTables.lang.de-DE.txt" />
<Content Include="Content\themes\Aristo\images\bg_fallback.png" />
<Content Include="Content\themes\Aristo\images\icon_sprite.png" />
<Content Include="Content\themes\Aristo\images\progress_bar.gif" />
Expand Down
20 changes: 20 additions & 0 deletions Mvc.JQuery.Datatables.Example/Views/Home/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,26 @@ can also use
.FilterOn("Id").NumberRange();
//.FilterOn("Number").CheckBoxes(Enum.GetNames(typeof(Numbers)));
vm.StateSave = true;

//vm.Language = "{ 'sUrl': '" + Url.Content("~/Content/jquery.dataTables.lang.de-DE.txt") + "' }";

vm.Language = "{" +
" 'sProcessing': 'Bitte warten...'," +
" 'sLengthMenu': '_MENU_ Einträge anzeigen'," +
" 'sZeroRecords': 'Keine Einträge vorhanden.'," +
" 'sInfo': '_START_ bis _END_ von _TOTAL_ Einträgen'," +
" 'sInfoEmpty': '0 bis 0 von 0 Einträgen'," +
" 'sInfoFiltered': '(gefiltert von _MAX_ Einträgen)'," +
" 'sInfoPostFix': ''," +
" 'sSearch': 'Suchen'," +
" 'sUrl': ''," +
" 'oPaginate': {" +
" 'sFirst': 'Erster'," +
" 'sPrevious': 'Zurück'," +
" 'sNext': 'Weiter'," +
" 'sLast': 'Letzter'" +
" }" +
"}";
}
@Html.Partial("DataTable", vm)

Expand Down
7 changes: 7 additions & 0 deletions Mvc.JQuery.Datatables.Templates/Views/Shared/DataTable.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@
},
"aoColumnDefs" : @Html.Raw(Model.ColumnDefsString)
@Html.Raw(!string.IsNullOrWhiteSpace(Model.JsOptionsString) ? ", " + Model.JsOptionsString : "")
@if (!string.IsNullOrEmpty(Model.Language))
{
<text>
,"oLanguage": @Html.Raw(@Model.Language)

</text>
}
});
@if (Model.ColumnFilter)
{
Expand Down
2 changes: 2 additions & 0 deletions Mvc.JQuery.Datatables/DataTableConfigVm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ public string Dom

public bool StateSave { get; set; }

public string Language { get; set; }

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