Skip to Content

How to change properties of a TableCell over Code ?

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Nov 09, 2004 at 01:38 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • Posted on Nov 09, 2004 at 03:21 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • Posted on Nov 10, 2004 at 09:20 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

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.