Logs.cshtml 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. }
  50. }
  51. function viewLog(id) {
  52. if (!id) return;
  53. $.ajax({
  54. url: '@Url.Action("viewLog", "Misc")',
  55. data: { Id: id },
  56. success: function (response) {
  57. setTimeout(function () {
  58. $(".logViewContainer").remove();
  59. $("body").append(response);
  60. }, 200);
  61. },
  62. error: function () {
  63. alert("error occured");
  64. }
  65. });
  66. }
  67. function deleteLog(id) {
  68. $.ajax({
  69. type: "POST",
  70. url: '@Url.Action("DeleteLog", "Misc")',
  71. data: { Id: id },
  72. success: function (response) {
  73. setTimeout(function () {
  74. devGridViewLog.PerformCallback();
  75. }, 200);
  76. },
  77. error: function () {
  78. alert("error occured");
  79. }
  80. });
  81. }
  82. </script>
  83. @Html.Partial("~/Views/Misc/_LogGridPartial.cshtml", Model)