Logs.cshtml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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 (e.item.name == "Print") {
  34. parent.$(".printPopupContainer").remove();
  35. $.ajax({
  36. type: "POST",
  37. url: '@Url.Action("ExportPartialLogs", "Misc")',
  38. data: { displayMode: "popup", exportFormat: "" },
  39. success: function (response) {
  40. parent.$("body").append(response);
  41. parent.exportFormat = "pdf";
  42. }
  43. });
  44. } else if (e.item.name == "ToggleColumnChooser") {
  45. if (devGridViewLog.IsCustomizationWindowVisible())
  46. devGridViewLog.HideCustomizationWindow();
  47. else
  48. devGridViewLog.ShowCustomizationWindow();
  49. } else if (e.item.name == "ResetSettings") {
  50. $.ajax({
  51. type: "POST",
  52. url: '@Url.Action("DeleteCookiesAndSessionVariables", "Global")',
  53. data: { cookies: [ "logGridStateCookie" ], sessionVariables: [ "LogGridState", "LogGridViewState" ] },
  54. success: function (response) {
  55. if (response == "success") {
  56. window.location = window.location;
  57. }
  58. }
  59. });
  60. }
  61. }
  62. function viewLog(id) {
  63. if (!id) return;
  64. $.ajax({
  65. url: '@Url.Action("viewLog", "Misc")',
  66. data: { Id: id },
  67. success: function (response) {
  68. setTimeout(function () {
  69. $(".logViewContainer").remove();
  70. $("body").append(response);
  71. }, 200);
  72. },
  73. error: function () {
  74. alert("error occured");
  75. }
  76. });
  77. }
  78. function deleteLog(id) {
  79. $.ajax({
  80. type: "POST",
  81. url: '@Url.Action("DeleteLog", "Misc")',
  82. data: { Id: id },
  83. success: function (response) {
  84. setTimeout(function () {
  85. devGridViewLog.PerformCallback();
  86. }, 200);
  87. },
  88. error: function () {
  89. alert("error occured");
  90. }
  91. });
  92. }
  93. </script>
  94. @Html.Partial("~/Views/Misc/_LogGridPartial.cshtml", Model)