Common.js 1.5 KB

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