cancel
Showing results for 
Search instead for 
Did you mean: 

How to add a column to a table dynamically.

Former Member
0 Kudos

Hi all,

I have to populate my table on certain search criteria.The table is binded to certain responce parameters of the web service.

As of now my requirement is to add a extra column at which in the run time will have the column name as LINK and the value for each row should be "click to view".

My query is how to achieve this.

Regards

DK

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Add the following code in method wdDoModifyView():

if (firstTime)
{
  IWDTable table = (IWDTable) view.getElement("ID-of-table");
  IWDTableColumn column = (IWDTableColumn) view.createElement(IWDTableColumn.class, null);
  table.addColumn(column);
  IWDLinkToAction link = (IWDLinkToAction) view.createElement(IWDLinkToAction.class, null);
  column.setTableCellEditor(link);
  link.setText("Click to view...");
  link.setOnAction(wdThis.wdGetOnViewAction());
  link.mappingOfOnAction().addSourceMapping
  (
    "nodeElement",
    "element"
  ); 
}

Add an action named "View" with a parameter named "element" of type IWDNodeElement.

Then at runtime this action parameter will contain the context node element corresponding to the table row where the link has been clicked.

Armin