Guest User

Untitled

a guest
Jun 21st, 2018
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. public class Dashboard
  2. {
  3. public List<Location> Locations { get; set; }
  4. public Filters FiltersDashboard { get; set; }
  5. }
  6.  
  7. public class Filters
  8. {
  9. public bool Filter1 { get; set; }
  10. public bool Filter2 { get; set; }
  11. public bool Filter3 { get; set; }
  12. etc...
  13. }
  14.  
  15. public ActionResult Monitor(Dashboard dashboard)
  16. {
  17. if(dashboard.Filters == null)
  18. {
  19. dashboard.Filters = new FiltersGSA();
  20. }
  21. return View(dashboard);
  22. }
  23.  
  24. [HttpPost]
  25. public async Task<ActionResult> Zoeken(Dashboard data, int current, int rowcount, Dictionary<string, string> sort)
  26. {
  27. return Json(await DataService.Search(data, current, rowcount, sort));
  28. }
  29.  
  30. $("#searchform").submit(function (event) {
  31. search();
  32. event.preventDefault();
  33. });
  34.  
  35. function search() {
  36. var model = @Html.Raw(Json.Encode(Model))
  37. $("#grid-data").bootgrid("destroy");
  38. $("#preloader").show();
  39. $("#grid-data").bootgrid({
  40. ajax: true,
  41. url: '@Url.Content("~/SlimmeMeter/Zoeken")',
  42. type: "POST",
  43. data: JSON.stringify(model),
  44.  
  45. rowCount: -1,
  46. multiSort: true,
  47.  
  48. formatters: {
  49. "DateOnly": function (column, row) {
  50. return Rendo.displayJsonDate(row[column.id]);
  51. }
  52. },
  53. responseHandler: function (response) {
  54. if (response.error) {
  55. $("#errorMessage").show("slow");
  56. $("#errorMessagePlaceholder").html(response.message);
  57. }
  58. else {
  59. //Eventueel error bericht verwijderen
  60. $("#errorMessage").hide("slow");
  61. }
  62.  
  63. $("#preloader").hide();
  64.  
  65. return response;
  66. },
  67. requestHandler: function (request) {
  68. return request;
  69. },
  70. });
  71. };
Add Comment
Please, Sign In to add comment