Logs.cshtml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. @{
  2. Layout = "~/Views/Shared/_FunctionLayout.cshtml";
  3. }
  4. @model IEnumerable<GreenTree.Nachtragsmanagement.Web.Models.Misc.LogDataModel>
  5. <script>
  6. var gridScrollHeight;
  7. var gridScrollOffset = 250;
  8. var resizeFinished;
  9. $(document).ready(function () {
  10. gridScrollHeight = calculateGridScrollHeight();
  11. setTimeout(function () {
  12. devGridViewLog.PerformCallback();
  13. }, 500);
  14. });
  15. $(window).resize(function () {
  16. clearTimeout(window.resizedFinished);
  17. window.resizedFinished = setTimeout(function () {
  18. setGridScrollHeight();
  19. }, 250);
  20. });
  21. function calculateGridScrollHeight() {
  22. var windowHeight = $(window).height();
  23. var gridHeaderHeight = $("#devGridViewLog_DXHeadersRow0").height();
  24. var gridFooterHeight = $("#devGridViewLog_DXFooterRow").height();
  25. return windowHeight - gridHeaderHeight - gridFooterHeight - gridScrollOffset;
  26. }
  27. function setGridScrollHeight() {
  28. gridScrollHeight = calculateGridScrollHeight();
  29. devGridViewLog.PerformCallback();
  30. }
  31. function onToolbarItemClick(s, e) {
  32. if (!s || !e) return;
  33. if (IsExportToolbarCommand(e.item.name)) {
  34. $("#Format").val(e.item.name);
  35. $("#logExportForm").submit();
  36. } else if (e.item.name == "ToggleColumnChooser") {
  37. if (devGridViewLog.IsCustomizationWindowVisible())
  38. devGridViewLog.HideCustomizationWindow();
  39. else
  40. devGridViewLog.ShowCustomizationWindow();
  41. }
  42. }
  43. function IsExportToolbarCommand(command) {
  44. return command == "Pdf" || command == "Xlsx" || command == "Xls";
  45. }
  46. function viewLog(id) {
  47. if (!id) return;
  48. $.ajax({
  49. url: '@Url.Action("viewLog", "Misc")',
  50. data: { Id: id },
  51. success: function (response) {
  52. setTimeout(function () {
  53. $(".logViewContainer").remove();
  54. $("body").append(response);
  55. }, 200);
  56. },
  57. error: function () {
  58. alert("error occured");
  59. }
  60. });
  61. }
  62. function deleteLog(id) {
  63. $.ajax({
  64. type: "POST",
  65. url: '@Url.Action("DeleteLog", "Misc")',
  66. data: { Id: id },
  67. success: function (response) {
  68. setTimeout(function () {
  69. devGridViewLog.PerformCallback();
  70. }, 200);
  71. },
  72. error: function () {
  73. alert("error occured");
  74. }
  75. });
  76. }
  77. </script>
  78. @using (Html.BeginForm("ExportPartialLogs", "Misc", FormMethod.Post, new { id = "logExportForm" }))
  79. {
  80. @Html.Hidden("Format")
  81. }
  82. @Html.Partial("~/Views/Misc/_LogGridPartial.cshtml", Model)