cancel
Showing results for 
Search instead for 
Did you mean: 

Adding dynamic table in static Group UI element

Former Member
0 Kudos

Hi Experts,

I have a Group UI element under Root Ui element. Now in wdDoinit i have crerated a dynamic table. Can some one suggest how can i add my table in that Group UI element?

Regards

Pranav

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Pranav,

you can only add dynamic elements in the wdDoModifyView method of your view.

So you best store your table element in the view-context, then use the following in your doModify:


// get the Table from context (may differ)
IWDTable myTable = wdContext.currentContextElement().getMyTable();
// get the group from view
IWDGroup group = view.getElement("<MYGROUP_ID>");
group.addChild(myTable);

hope that helps.

Jan

Former Member
0 Kudos

Storing UI element instances in the context is not recommended. I wonder why the table needs to be created programmatically at all especially because it is already done in wdDoInit().

Armin

Former Member
0 Kudos

Thanks a lot every one. Yes i feel it is not required to add table in group in wddomodify when table is already there in wddoinit. I can add table in group in wddoinit itself.

Regards

Pranav

Former Member
0 Kudos

Creating UI elements outside of wdDoModifyView() (or methods called from there) violates the programming model and is not recommended. I would like to better understand your use case and give a clean solution.

Armin

Former Member
0 Kudos

I am getting table data, which includes data that will appear in table as well as no. of coulmns, from a web service. Once i know the no. of cloumns, this table is just a static display table. So, i dont want to modify it everytime there is some modification in view it can slow down the loading of "view in explorer".

If i am violating the programming model, i think i can keep the table creation code in wddomodify with first time condition.

Will that be fine?

Regards

Pranav

Edited by: Pranav Nagpal on Sep 25, 2009 12:50 PM

Former Member
0 Kudos

yes, using the firstTime condition is exactly the right location for this.

nice weekend

Jan

Former Member
0 Kudos

Thanks a lot Jan, Happy weekend, enjoy.

Regards

Pranav

Former Member
0 Kudos

Thanks a lot Armin for correcting me.

Former Member
0 Kudos

The general technique for such use-cases is to use a boolean context attribute, say "tableStructureInvalid". In the controller method that invalidates the table structure, set the flag to true. In wdDoModifyView(), not only at "firstTime", check the flag, rebuild the table structure as needed and set the flag to false again.

Armin

Answers (0)