Hi,
I would like to create a custom control that extends sap.m.Table. This control should first render some HTML and a second control before the super class of the control, i.e., the content of the control itself, is rendered. I tried it like this:
jQuery.sap.declare('dev.view.control.MyControl'); sap.m.Table.extend('dev.view.control.MyControl', { metadata: { aggregations : { _fixedHeaderTable : {type : 'sap.m.Table', multiple : false, visibility: 'hidden'} } }, init: function() { if (sap.m.Table.prototype.init) { sap.m.Table.prototype.init.apply(this, arguments); } var fixedHeaderTable = new sap.m.Table({}); this.setAggregation('_fixedHeaderTable', fixedHeaderTable); }, renderer: { render : function(oRm, oControl) { if (!oControl.getVisible()) { return; } oRm.write('<div class="fixedTable">'); oRm.renderControl(oControl.getAggregation('_fixedHeaderTable')); oRm.write('</div>'); sap.m.TableRenderer.render(oRm, oControl); } } }
However, this triggers the render method 3 times and the content is rendered 3 times in the output. From my first debugging steps, it seems that the super call of the TableRenderer triggers some rerendering which, in turn, calls the render function of my control again.
Does anyone know what I am doing wrong?