EasyUI.Extend.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. 
  2. //****************************************************************************************//
  3. //**********************************EasyUI函数扩展****************************************//
  4. $.fn.extend({
  5. cmsPanel: function (obj) {
  6. var target = $(this);
  7. var newObj;
  8. if (typeof (obj) == "object" && obj.href) {
  9. newObj = $.extend({}, obj);
  10. var newUrl = ("/" + CMS_SystemConfig.VirtualDirectoryPath + obj.href.replace(CMS_SystemConfig.VirtualDirectoryPath, "")).replaceDoubleSlashesToSingle();
  11. newObj.href = newUrl;
  12. }
  13. else {
  14. newObj = obj;
  15. }
  16. return target.panel(newObj);
  17. },
  18. cmsDialog: function (obj) {
  19. var target = $(this);
  20. var newObj;
  21. if (typeof (obj) == "object" && obj.href) {
  22. newObj = $.extend({}, obj);
  23. var newUrl = ("/" + CMS_SystemConfig.VirtualDirectoryPath + obj.href.replace(CMS_SystemConfig.VirtualDirectoryPath, "")).replaceDoubleSlashesToSingle();
  24. newObj.href = newUrl;
  25. }
  26. else {
  27. newObj = obj;
  28. }
  29. return target.dialog(newObj);
  30. },
  31. getDataGridRowIndex: function (o) {
  32. var p = $(o);
  33. while (p && p.size() > 0) {
  34. if (p.attr("datagrid-row-index")) {
  35. return parseInt(p.attr("datagrid-row-index"));
  36. } else if (p.attr("node-id")) {
  37. return p.attr("node-id");
  38. }
  39. p = p.parent();
  40. }
  41. return -1;
  42. },
  43. disable: function () {//禁用控件,用法$(**).disable();
  44. this.each(function () {
  45. var _this = $(this);
  46. _this.attr({ "disabled": "disabled" });
  47. _this.addClass("disabled");
  48. _this.removeClass("validatebox-invalid");
  49. });
  50. },
  51. enable: function () {//启用控件,用法$(**).enable();
  52. this.each(function () {
  53. var _this = $(this);
  54. _this.removeAttr("disabled");
  55. _this.removeClass("disabled");
  56. });
  57. }
  58. });
  59. $.messager.CloseProgress = function () {
  60. /// <summary>
  61. /// 关闭$.messager.progress进度条
  62. /// </summary>
  63. var win = $("div.messager-progress").closest("div.messager-body");
  64. if (win.length) {
  65. win.window("close");
  66. }
  67. }
  68. //******************************************End******************************************//
  69. //***************************************************************************************//