Show TOC

Binding Custom Controls to a ContextLocate this document in the navigation structure

Use

Custom controls can be bound to context nodes and attributes. Nodes that are not contained in the view context of a custom control cannot be accessed directly. These nodes have to be mapped first into the view context of the view containing the custom control.

Procedure
  1. Navigate to the Layout tab page of the View.

  2. Select the custom control.

  3. Select the dataSource property, and choose Bind .

  4. In the Context Viewer dialog, select the context node.

  5. Choose OK .

  6. Navigate to the Context tab page.

  7. Select the context node.

  8. Set the Collection Cardinality and Selection Cardinality of the context node to 1..1 .

  9. In the Java Editor of the view, write code to bind the custom control to a context node attribute.

    Example

    You can bind a single context node attribute using the ViewItem#bindProperty() method. This code snippet is implemented within the wdDoModifyView() method

    //Binding the enabled property of custom control to a context node attribute "Status"

    view.getInteractiveFormViewItem().bindProperty("enabled", wdContext.nodeorder(), "Status");

  10. In the Java perspective, expand the mobile Java component.

  11. Implement the setContextNode(IWDNode node) method in the adapter class.

    More information: http://help.sap.com/javadocs Start of the navigation path Mobile 7.3 Next navigation step Mobile Applications for Handhelds Next navigation step com.sap.tc.mobile.wdlite.renderer.api (Packages) Next navigation step BaseWdliteUiElementMethodCallAdapter (Class) Next navigation step setContextNode (Method) End of the navigation path