Table.js 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. MWF.xDesktop.requireApp("portal.PageDesigner", "Module.Table$Td", null, false);
  2. MWF.xApplication.portal.PageDesigner.Module.Table = MWF.PCTable = new Class({
  3. Extends: MWF.FCTable,
  4. Implements: [Options, Events],
  5. options: {
  6. "style": "default",
  7. "propertyPath": "../x_component_portal_PageDesigner/Module/Table/table.html",
  8. "propertyMultiPath": "../x_component_portal_PageDesigner/Module/Table$Td/table$tdMulti.html"
  9. },
  10. initialize: function(form, options){
  11. this.setOptions(options);
  12. this.path = "../x_component_portal_PageDesigner/Module/Table/";
  13. this.cssPath = "../x_component_portal_PageDesigner/Module/Table/"+this.options.style+"/css.wcss";
  14. this._loadCss();
  15. this.moduleType = "component";
  16. this.moduleName = "table";
  17. this.form = form;
  18. this.container = null;
  19. this.containerNode = null;
  20. this.containers = [];
  21. this.elements = [];
  22. this.selectedMultiTds = [];
  23. },
  24. _getContainers: function(){
  25. //var tds = this.node.getElements("td");
  26. var tds = this._getTds();
  27. this.form.getTemplateData("Table$Td", function(data){
  28. tds.each(function(td){
  29. var json = this.form.getDomjson(td);
  30. var tdContainer = null;
  31. if (!json){
  32. var moduleData = Object.clone(data);
  33. tdContainer = new MWF.PCTable$Td(this.form);
  34. tdContainer.table = this;
  35. tdContainer.load(moduleData, td, this);
  36. }else{
  37. if(!json.events)json.events = Object.clone(data.events);
  38. tdContainer = new MWF.PCTable$Td(this.form);
  39. tdContainer.table = this;
  40. tdContainer.load(json, td, this);
  41. }
  42. this.containers.push(tdContainer);
  43. }.bind(this));
  44. }.bind(this));
  45. },
  46. _getElements: function(){
  47. // this.elements.push(this);
  48. var captions = this.node.getElements("caption");
  49. captions.each(function(caption){
  50. var json = this.form.getDomjson(caption);
  51. var el = null;
  52. if (!json){
  53. this.form.getTemplateData("Common", function(data){
  54. var moduleData = Object.clone(data);
  55. el = new MWF.PCCommon(this.form);
  56. el.table = this;
  57. el.load(moduleData, caption, this);
  58. }.bind(this));
  59. }else{
  60. el = new MWF.PCCommon(this.form);
  61. el.table = this;
  62. el.load(json, caption, this);
  63. }
  64. this.elements.push(el);
  65. }.bind(this));
  66. },
  67. });