cancel
Showing results for 
Search instead for 
Did you mean: 

Is there any event for table after render?

Former Member
0 Kudos

Hi All,

I want to add extra row in table after rendering of table. Is there any way to add extra row after table is bind to model.

I can do DOM manipulation if I get onAfterRender event of table. But in specification I didn't find any such event.

I am able to add columns in table also they are bound to model.Once data is bound base on some calculation I have to add extra row in bottom of table. Bottom row is nothing but summation of data shown in top rows.

Any help is appreciated

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

SergioG_TX
Active Contributor
0 Kudos

not sure about the event.. but you could add the object to your model and then do a refresh which would cause the same behavior. a new row should be added at the bottom of your table.

maximilian_lenkeit
Participant
0 Kudos

Every control supports onAfterRendering. You can attach a handler via the addEventDelegate method.

However, note that adding an extra row cannot be done via addRow, the table has to be model driven. So you can either add the data to the model (as suggested by Sergio above; also my recommendation) or you need to manipulate the DOM directly.

But if you want to add a total, you might want to look into the AnalyticalTable control, I believe it has native support for such a feature.

- Max

Former Member
0 Kudos

I cant add extra row to model as same model is bound to three other view and it will be big change in order to hide this row.

Former Member
0 Kudos

onAfterRendering method is not present for table control.
I have added this but it fails in rendering table UI with fixedColumnCount property set.

as

myTableControl.onAfterRendering = function(){

  console.log("Called after Rendering");

  };

Because of this table is not render properly.
But when I comment this function, it works properly.
I think sapui5 do something in onAfterRendering method.
which I override by above function causing failed in rendering table control.

Is there any other way by which I can call onAfterRendering event after sapui5 rendering event fire.

As you mention use of "addEventDelegate", can you provide any sample how code is written? I have checked

addEventDelegate(oDelegate, oThis?) but I didn't understand it properly, how could I add on after render method for table with this?

maximilian_lenkeit
Participant
0 Kudos

Here's an example of the usage of addEventDelegate. Instead of onfocusin, you can simply use onAfterRendering: JS Bin - Collaborative JavaScript Debugging</title> <link rel="alternate" type=&q...

Also, you can overwrite onAfterRendering as you did above, but you'll need to invoke the default implementation via sap.ui.table.Table.prototype.onAfterRendering.apply(this, arguments); before invoking any custom logic (e.g. console.log).

Note that addEventDelegate is the preferred approach.

- Max

former_member182862
Active Contributor
0 Kudos

Like other folks have mentioned. It is going to be a hack 😞

Example

-D

former_member225463
Participant
0 Kudos

Hello Dennis,

I follow your code.

For the first time the event is not getting triggered , from the second time the event is working properly.

Can you please suggest what i am missing or i need to do any changes in your code.

Thanks and Regards,

Vikash

former_member225463
Participant
0 Kudos

Hello Max,

I follow your code.

For the first time the event is not getting triggered , from the second time the event is working properly.

Can you please suggest what i am missing or i need to do any changes in your code.

Thanks and Regards,

Vikash

maximilian_lenkeit
Participant
0 Kudos

Hi Vikash,

this could happen for a number of reasons...

- When/where do you call addEventDelegate? Ideally, it should be called from a controller's onInit function.

- How did you determine that the callback is not triggered? Set a breakpoint into the callback to make sure that it is actually not being triggered and that it's not just your code inside the callback that might not be working.

Regards,

Max

former_member225463
Participant
0 Kudos

Hi Max,

Thanks for the reply.

I have completed it by using the event of odata call finishes.From there i can call the table length.

Thanks for the suggestion.

Regards,

Vikash

Answers (1)

Answers (1)

Former Member
0 Kudos

declare any method to UpdateFinished property of Table and do validations in that method.It worked for me earlier related to validations after rendering table.

Regards,

Koti Reddy