Logs.cshtml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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("DeleteCookiesSessionVariablesAndUserConfigs", "Global")',
  53. data: {
  54. cookies: ["logGridStateCookie"],
  55. sessionVariables: ["LogGridState", "LogGridViewState"],
  56. userConfigItemNames: ["LogGridLayoutState"]
  57. },
  58. success: function (response) {
  59. if (response == "success") {
  60. window.location = window.location;
  61. }
  62. }
  63. });
  64. }
  65. }
  66. function viewLog(id) {
  67. if (!id) return;
  68. $.ajax({
  69. url: '@Url.Action("viewLog", "Misc")',
  70. data: { Id: id },
  71. success: function (response) {
  72. setTimeout(function () {
  73. $(".logViewContainer").remove();
  74. $("body").append(response);
  75. }, 200);
  76. },
  77. error: function () {
  78. alert("error occured");
  79. }
  80. });
  81. }
  82. function deleteLog(id) {
  83. $.ajax({
  84. type: "POST",
  85. url: '@Url.Action("DeleteLog", "Misc")',
  86. data: { Id: id },
  87. success: function (response) {
  88. setTimeout(function () {
  89. devGridViewLog.PerformCallback();
  90. }, 200);
  91. },
  92. error: function () {
  93. alert("error occured");
  94. }
  95. });
  96. }
  97. </script>
  98. @Html.Partial("~/Views/Misc/_LogGridPartial.cshtml", Model)