Common.js 1.5 KB

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