Skip to Content
author's profile photo Former Member
Former Member

How to add columns in table via code?

Hi all,

is it possible to add columns in a Web Dynpro table via code? Is there an example how to do this?

Thanks a lot.

Regards

Carsten

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jul 01, 2004 at 07:32 AM

    Hi Carsten,

    yes this is possible. An example showing the basics is available here: http://help.sap.com/saphelp_nw04/helpdata/en/4f/07cf3dd28b5610e10000000a114084/frameset.htm

    In case of your table, create an instance of IWDTableColumn.class and add it using the addColumn() method of the IWDTable API. This sample uses an InputField as table cell editor:

    IWDTableColumn col = (IWDTableColumn) view.createElement(IWDTableColumn.class, "newcol");
    IWDInputField editor = (IWDInputField) view.createElement(IWDInputField.class, "edit");
    col.setTableCellEditor(editor);
    IWDTable tab = (IWDTable) view.getElement("yourTabName");
    tab.addColumn(col);

    If you don't need specific names for the dynamic created elements, you can use null instead of the names calling the view.createElement() method, then a unique name will be auto-generated.

    Hope that helps.

    Regards

    Stefan

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 01, 2004 at 09:49 AM

    Hi Stefan,

    thanks a lot. I will try it.

    Regards,

    Carsten

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Depending on your use case, it might also be an option to create all needed columns initially and to use the TableColumn.visibility property to show only a subset of the column at a certain point of time.

      Regards, Armin

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.