DropdownContainer.js
上传用户:kimgenplus
上传日期:2016-06-05
资源大小:20877k
文件大小:3k
源码类别:

OA系统

开发平台:

Java

  1. /*
  2. Copyright (c) 2004-2006, The Dojo Foundation
  3. All Rights Reserved.
  4. Licensed under the Academic Free License version 2.1 or above OR the
  5. modified BSD license. For more information on Dojo licensing, see:
  6. http://dojotoolkit.org/community/licensing.shtml
  7. */
  8. dojo.provide("dojo.widget.DropdownContainer");
  9. dojo.require("dojo.widget.*");
  10. dojo.require("dojo.widget.HtmlWidget");
  11. dojo.require("dojo.widget.PopupContainer");
  12. dojo.require("dojo.event.*");
  13. dojo.require("dojo.html.layout");
  14. dojo.require("dojo.html.display");
  15. dojo.require("dojo.html.iframe");
  16. dojo.require("dojo.html.util");
  17. dojo.widget.defineWidget("dojo.widget.DropdownContainer", dojo.widget.HtmlWidget, {inputWidth:"7em", id:"", inputId:"", inputName:"", iconURL:dojo.uri.moduleUri("dojo.widget", "templates/images/combo_box_arrow.png"), copyClasses:false, iconAlt:"", containerToggle:"plain", containerToggleDuration:150, templateString:"<span style="white-space:nowrap"><input type="hidden" name="" value="" dojoAttachPoint="valueNode" /><input name="" type="text" value="" style="vertical-align:middle;" dojoAttachPoint="inputNode" autocomplete="off" /> <img src="${this.iconURL}" alt="${this.iconAlt}" dojoAttachEvent="onclick:onIconClick" dojoAttachPoint="buttonNode" style="vertical-align:middle; cursor:pointer; cursor:hand" /></span>", templateCssPath:"", isContainer:true, attachTemplateNodes:function () {
  18. dojo.widget.DropdownContainer.superclass.attachTemplateNodes.apply(this, arguments);
  19. this.popup = dojo.widget.createWidget("PopupContainer", {toggle:this.containerToggle, toggleDuration:this.containerToggleDuration});
  20. this.containerNode = this.popup.domNode;
  21. }, fillInTemplate:function (args, frag) {
  22. this.domNode.appendChild(this.popup.domNode);
  23. if (this.id) {
  24. this.domNode.id = this.id;
  25. }
  26. if (this.inputId) {
  27. this.inputNode.id = this.inputId;
  28. }
  29. if (this.inputName) {
  30. this.inputNode.name = this.inputName;
  31. }
  32. this.inputNode.style.width = this.inputWidth;
  33. this.inputNode.disabled = this.disabled;
  34. if (this.copyClasses) {
  35. this.inputNode.style = "";
  36. this.inputNode.className = this.getFragNodeRef(frag).className;
  37. }
  38. dojo.event.connect(this.inputNode, "onchange", this, "onInputChange");
  39. }, onIconClick:function (evt) {
  40. if (this.disabled) {
  41. return;
  42. }
  43. if (!this.popup.isShowingNow) {
  44. this.popup.open(this.inputNode, this, this.buttonNode);
  45. } else {
  46. this.popup.close();
  47. }
  48. }, hideContainer:function () {
  49. if (this.popup.isShowingNow) {
  50. this.popup.close();
  51. }
  52. }, onInputChange:function () {
  53. }, enable:function () {
  54. this.inputNode.disabled = false;
  55. dojo.widget.DropdownContainer.superclass.enable.apply(this, arguments);
  56. }, disable:function () {
  57. this.inputNode.disabled = true;
  58. dojo.widget.DropdownContainer.superclass.disable.apply(this, arguments);
  59. }});