cancel
Showing results for 
Search instead for 
Did you mean: 

Binding data to design time table

Former Member
0 Kudos

Hi

I want to bind data to table which is cerated at design time. I know that we can do it using IPrivate<viewName> but i am not sure. Can any one help me.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Can you give more details? You have created a table at design time and what exactly do you want to do at runtime? Adding a column?

Armin

Former Member
0 Kudos

I want to bind data that is in view context through code. I know that I can use apply template and bind data to table in view.

former_member186016
Active Contributor
0 Kudos

Hi,

Try to follow this tutorial. It shows how you can create UI elements dynamically, bind them to context and populate the context.

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/49f2ea90-0201-0010-ce8e-de18b94a...

Regards,

Ashwani Kr Sharma

Former Member
0 Kudos

The following code adds a table column to an existing table and uses an input field as cell editor. A boolean attribute "addColumn" is used to control whether the column should be added.

Code is for NW04. In NW04s, use addGroupedColumn(). The table data source node is named "Rows" in this example.

wdDoModifyView()
{
  if ( wdContext.currentContextElement().getAddColumn() )
  {
    /* Get the table instance */
    IWDTable table = (IWDTable) view.getElement("TableID");

    /* Create and add table column */
    IWDTableColumn column = (IWDTableColumn) view.createElement(IWDTableColumn.class, null);
    table.addColumn(column);

    /* Create and add column editor */
    IWDInputField editor = (IWDInputField) view.createElement(IWDInputField.class, null);
    editor.bindValue(IPrivate<View>.IRowsElement.<ATTRIBUTE_NAME>);
    column.setCellEditor(editor);

    /* Create and add column header */
    IWDCaption header = (IWDCaption) view.createElement(IWDCaption.class, null);
    header.setText("Here I am!");
    column.setHeader(header);

    /* Reset flag to avoid adding multiple times */
    wdContext.currentContextElement().setAddColumn(false);
  }
}

Armin