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

Changing table layout at runtime

I've created a table at design time which is mapped to a model. Later at runtime I want to dynamically add different columns from this model to the table and bind them.

The object IWBTable offers several methods to manipulate the table layout including binding columns to models. But at runtime I can't manage to get access to the runtime table instance. Is it possible to get access to that object at all? If not how can I manipulate the table layout at runtime without manipulating the model?

Best regards,

Christian

Add comment
10|10000 characters needed characters exceeded

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Apr 01, 2004 at 03:47 PM

    Christian,

    the only method where you can access view elements is the static method wdDoModifyView() in the view controller class. (Please read also the JavaDoc comment of this method).

    In that method, you may access and create view elements.

    Example: How to create a new table column with ID "myColumn" that uses an InputField as its cell editor, and adding the column to an existing table with ID "myTable":

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

    IWDTableColumn column = (IWDTableColumn) view.createElement(IWDTableColumn.class, "myColumn");

    IWDInputField editor = (IWDInputField) view.createElement(IWDInputField.class, null /* ID not needed */);

    editor.bindValue("someTableDataAttributePath");

    column.setTableCellEditor(editor);

    table.addColumn(column);

    Hope this helps!

    Armin

    Add comment
    10|10000 characters needed characters exceeded