on 2004 Apr 01 11:07 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Armin,
thank you for your fast answer! By coincidence I found the reference to the view some minutes before your posting.
What I did was that I stored the reference to the table in a static variable in the view controller. I use this reference in Action handlers without any trouble!
Do you know why the JavaDoc of the wdDoModifyView says that all coding which manipulate the view should be stored inside that method? Do you know if the reference to the view changes during runtime?
Isn't the livetime of a view connected to the livetime of its controller?
Thank you and best regards,
Christian
Hi Armin,
thanks again for your answer!
I'm a litte bit confused now. I need to change the layout of a view with Actions. Even sometimes with Events. But Actions / Events happening before the wdDoModifyView method is invoked... Meaning I have to use some helper funtions witch are I call from wdDoModifyView every time it is invoked, these helper functions get the new reference to the view and then evaluate if there is any change that needs to be done. Do you think this would be an good way to do that?
Is there a better way to archive this? Is it at all legal by means of the WebDynpro Framework?
Do you maybe know any example where dynamic view layout is implemented in a view controller?
Thank you very much,
Christian
Christian,
what you could do:
In the action event handler, store some kind of configuration info in the view context.
In wdDoModifyView(), evaluate the configuration info and accordingly change the view.
Finally, clear the configuration info such that the next call to wdDoModifyView() will not execute the changes again.
Regards, Armin
User | Count |
---|---|
79 | |
10 | |
10 | |
10 | |
10 | |
9 | |
8 | |
7 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.