cancel
Showing results for 
Search instead for 
Did you mean: 

How to change properties of a TableCell over Code ?

J_B
Explorer
0 Kudos

Hy all,

i want to enable a cell of the selected row over code.

How can i do this ?

I dont know, how to get the UI-Element table of my view over code.

I have read the API and have seen all the method to change the properties, but not found the method to get any of my UI-Elements of the actual view.

Is there any method to get or browse all the UI-Elements of the view ?

Have anyone a code-example to get a UI-Element of a view ?

Thanks for help.

by Jürgen

Accepted Solutions (0)

Answers (3)

Answers (3)

J_B
Explorer
0 Kudos

Hello Armin, hello Valery

thanks for help !

But it is not working in my Version 2.0.6.

If I want to create a new value attribute to my node a got a error message:

"Adding attributes is currently not supported if the node or the model class (for context model notes) has a dictionary structure binding"

What can i do ?

The only way i think is to create a new data node, copy the model node to the new node with the boolean extension, map the boolean to the "enable" property, and hope it works !

Regards

Jürgen

J_B
Explorer
0 Kudos

Hy Valery,

another problem i have is to reload the page.

The scenario is that i have a page with an Interactive Form UI-Elemnent (Adobe Formular) with data from the backend. After the changes at the formular the data were send to the backend. At the backend there some calculations and so on. How can i reload the UI-Element to show the changes to the client.

Are there any method to invalidate the view or trigger the page reload ?

Regards

Jürgen

Former Member
0 Kudos

The code I've provided works since SP5.

The problem is realy with structure binding, so, you are right: you need intermediate node in View controller with "plain" attributes, and 2 routines to copy data back and forth between this mode and original one.

VS

J_B
Explorer
0 Kudos

Hy Valery,

i have tested it and it works. But no i hava a problem with the syncronisation.

I have an Viewset with a search view on the top and a list view (with table) on the buttom.

After the action "Search" i call a rfc-methode to get the data for the list view. Then the Outbound-plug were called.

On the init-methode of the list view i copy the nodeRFC to the nodeTMP, which i linked as the data source of the Table. If i transfer the copy process to the modify-Method i cant select any row of may table.

So good, but both view's are now visible and if the button search was pressed again, no changes are visible to the list view. If the button pressed again or two times i got the right values !

Where is my fault ?

On which place must i invalidate my nodeRFC ?

or

It is better to create a data note at the context controller, bind it to the context of the view and copy the node at the executeRFC-Method of the controller context ?

Thanks for help.

Regards

Jürgen

thomas_chadzelek
Participant
0 Kudos

Hello,

have you tried adding a non-singleton value node with cardinality 1..1 (initializeLeadSelection = true) as child to the node in question? Inside that new node, you can add attributes again. No need to copy data back & forth. Use a supply function to provide the data just in time. For data binding, it does not matter if the attribute belongs to the data source node itself or to a child node (as long as the child node is reachable via lead selection).

Best regards,

Thomas

J_B
Explorer
0 Kudos

Hy Valery,

my scenario is to enable a Button or LinkToURL UI-Element in a table cell of the selected row. The data in the table are mapped from a node und the Button/LinkToURL Element was insertet by visual editor with property enable = false.

I have a action onLeadSelection to get the parameters of the selected row to build the right URL.

Do I have access in the action to the wdDoModifyView-Method to change the property ?

How can i change the cell-enable-property of the selected row ?

I can get the table, the array of tablecolumns and an iterator over the table. But i have not found a method

to get the column like table.getColumn(XXX).

I have read the IDWTable API with the following text:

"Table columns are defined by aggregating TableColumn

objects. Each table column has a table cell editor.

Every property of the table cell editor may be bound

either

to an attribute of the context node X, or

to a context root attribute.

Now I am a little bit confused. Do I need a value attribute "URL" in my model node?

But this should not solve my problem to enable a Cell of a table, or ?

Thanks for help.

Jürgen

Former Member
0 Kudos

Hello,

you can do this by data binding.

To display buttons in a certain table column, you must have added a cell editor of type IWDButton to this column.

Add a new value attribute "buttonEnabled" of type "boolean" to the data source node of the table. Bind the property "enabled" of the cell editor to this attribute.

The effect is: The button in a table row is enabled if and only if the attribute "buttonEnabled" in the corresponding node element has the value "true". Remember: Each node element represents a table row.

The (lead) selected table row corresponds to the lead (selected) node element, so it is clear how to enable/disable the button in the selected table row.

You can do all this in the view designer without writing code.

Armin

Former Member
0 Kudos

Well, what you need is not possible to achive with UI controls manipulations (if it is still interesting for you I may reply separately). In general, direct manipulations will set properties to cell renderers in <i>every</i> table row.

Here what can be done to enable functionality required.

1. In your node create <i>read-only calculated boolean</i> attribute <b>IsEnabled</b>.

2. In calculate function write the following:

return element.node().getLeadSelection() == element.index();

3. Bind <i>Enabled</i> properties of corresponding table cell editors to this attribute

Regards,

VS

Former Member
0 Kudos

Hi,

The only place where you can get access to UI controls is wdDoModifyView method of the View Controller.

Getting elements is simple:


IWDInputField input = (IWDInputField)view.getElement("<element-id>");

To traverse the whole tree you need first get access to root UI element of the view:


IWDUIElementContainer root = (IWDUIElementContainer)view.getElement("RootUIElementContainer");

The you can get all of its children:


IWDUIElement[] directChildren = root.getChildern();

Later you can traverse recursively by directChildren if concrete child is instance of IWDUIElementContainer.

Obviously, you can start from any container.

Hope this helps,

VS

Former Member
0 Kudos

Well, almost.

It is possible to generically visit all UI elements in the UI tree, but it doesn't suffice to visit the children of containers. The UI tree is not only spanned by the child-relation but also by other relations.

The upcoming book "Inside Web Dynpro for Java" by Chris Whealy describes a method of how to accomplish this.

Armin

Message was edited by: Armin Reichert