Common.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
  2. /** @class Common 通用组件。
  3. * @example
  4. * //可以在脚本中获取该组件
  5. * //方法1:
  6. * var attachment = this.form.get("name"); //获取组件
  7. * //方法2
  8. * var attachment = this.target; //在组件事件脚本中获取
  9. * @extends MWF.xApplication.process.Xform.$Module
  10. * @category FormComponents
  11. * @hideconstructor
  12. */
  13. MWF.xApplication.process.Xform.Common = MWF.APPCommon = new Class({
  14. Extends: MWF.APP$Module,
  15. _loadUserInterface: function(){
  16. if (this.json.innerHTML){
  17. var nodes = this.node.childNodes;
  18. for (var i=0; i<nodes.length; i++){
  19. if (nodes[i].nodeType===Node.ELEMENT_NODE){
  20. if (!nodes[i].get("MWFtype")){
  21. nodes[i].destroy();
  22. i--;
  23. }
  24. }else{
  25. if (nodes[i].removeNode){
  26. nodes[i].removeNode();
  27. }else{
  28. nodes[i].parentNode.removeChild(nodes[i]);
  29. }
  30. i--;
  31. //nodes[i]
  32. }
  33. }
  34. this.node.appendHTML(this.json.innerHTML);
  35. // if (this.node.get("html") !== this.json.innerHTML){
  36. //this.node.appendHTML(this.json.innerHTML);
  37. // }
  38. }
  39. this.node.setProperties(this.json.properties);
  40. }
  41. });