rdi.easyui-extend.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. //(function ($) {
  2. //})(jQuery)
  3. function autoResize(c) {
  4. var a = {
  5. width: 6,
  6. height: 119,
  7. gridType: "jqgrid"
  8. };
  9. c = $.extend(a, c);
  10. var d = b();
  11. if ($.isFunction(c.callback)) {
  12. c.callback(d);
  13. }
  14. $(window).resize(function () {
  15. var e = b(true);
  16. switch (c.gridType) {
  17. case "datagrid":
  18. $(c.dataGrid).datagrid("resize", {
  19. width: e.width,
  20. height: e.height
  21. });
  22. break;
  23. case "treegrid":
  24. $(c.dataGrid).treegrid("resize", {
  25. width: e.width,
  26. height: e.height
  27. });
  28. break;
  29. case "jqgrid":
  30. $(c.dataGrid).jqGrid("setGridHeight", e.height).jqGrid("setGridWidth", d.width);
  31. break;
  32. }
  33. });
  34. function b(e) {
  35. var g = 0;
  36. var f = 0;
  37. if (typeof (window.innerHeight) == "number") {
  38. g = window.innerHeight;
  39. f = window.innerWidth;
  40. } else {
  41. if (document.documentElement && document.documentElement.clientHeight) {
  42. g = document.documentElement.clientHeight;
  43. f = document.documentElement.clientWidth;
  44. } else {
  45. if (document.body && document.body.clientHeight) {
  46. g = document.body.clientHeight;
  47. f = document.body.clientWidth;
  48. }
  49. }
  50. }
  51. f -= c.width;
  52. g -= c.height;
  53. return {
  54. width: f,
  55. height: g
  56. };
  57. }
  58. };