cancel
Showing results for 
Search instead for 
Did you mean: 

dynpro table -dynamically change table header name

Former Member
0 Kudos

how to change table header name at runtime ?

for instance, when i bind to a dataNode with this attribute:

smsid, usrid, crdate, stdate,enddate

change to

message_id, user_id, create_date, start_date, end_date during runtime.

Accepted Solutions (1)

Accepted Solutions (1)

former_member751941
Active Contributor
0 Kudos

Hi yzme,

To change the column header for each field you have to set the [Caption-Header] text value.

Use this code inside "wdDoModifyView" method.

//@@begin wdDoModifyView

IWDCaption smsid_caption = (IWDCaption)view.getElement("smsid_header");

smsid_caption.setText("message_id");

IWDCaption usrid_caption = (IWDCaption)view.getElement("usrid_header");

usrid_caption.setText("user_id");

IWDCaption crdate_caption = (IWDCaption)view.getElement("crdate_header");

crdate_caption.setText("create_date");

IWDCaption stdate_caption = (IWDCaption)view.getElement("stdate_header");

stdate_caption.setText("start_date");

IWDCaption enddate_caption = (IWDCaption)view.getElement("enddate_header");

enddate_caption.setText("end_date ");

//@@end

Regards,

Mithu

Answers (3)

Answers (3)

Former Member
0 Kudos

IWDCaption colHeader =

(IWDCaption) view.createElement(IWDCaption.class, "NameHeader");

colHeader.setText("–¼‘O");

nameColumn.setHeader(colHeader);

try this code inside wdDoModifyView

luciano_leitedasilva
Contributor
0 Kudos

Hi there,

You can build two tables at design time and manage which table is visible. There are some ways to do this, like using dynamic programin, change visibility or setting the right values at a node attribute. You must to choose what way is suitable to your requiriments.

Regards,

Luciano

Former Member
0 Kudos

Inside your wdDoModifyView you can try the following:

Catch the table object:

IWDTable table = (IWDTable)view.getElement("Table1");

Catch the column for which you want to change the header by index

IWDTableColumn column = table.getColumn(0);

Then set the column header with your choice of value:

column.getHeader().setText("My New Header Text");

You can keep on setting your column header in a loop or something like that depending upon your requirement.

Hope it helps

Shubhadip