on 08-10-2005 10:48 AM
Hello All,
How do i create an Attribute to the dynamically created Node ?
I tried using code:
IWDAttributeInfo fieldName = myNode.addAttribute("Attr0",
"com.sap.dictionary.string");
But not sure whether it creates Attribute of AttributeInfo ..
Please explain IWDAttribute.
Regards,
Aayush
Extending my example from another your post:
/* You are creating metadata */
final IWDNodeInfo niEmployees
= wdContext.getNodeInfo().addChild("Employees", /*..*/);
/* Attribute info is metadata as well */
final IWDAttributeInfo aiName
= niEmployees.addAttribute("Name", "com.sap.dictionary.string");
/* Now you are accessing data */
/* First node -- "list" of elements */
final IWDNode nEmployees = wdContext.getChild
(
niEmployees.getName(), /* or "Employees" */
IWDNode.LEAD_SELECTION
);
/* Then element */
final IWDNodeElement elEmployee = nEmployees.createElement();
/* Now attribute(s) of element */
elEmployee.setAttributeValue
(
aiName.getName(), /* or "Name" */
"Aayush Dubey"
);
nEmployees.addElement(elEmployee);
VS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello VS,
I tried using the dynamic context in wdDoModify method as:
IWDTextView myTxtView= (IWDTextView) view.getElement("DefaultTextView");
IWDAttributeInfo nInfo = wdContext.getChildNode("Employees",0).getNodeInfo().getAttribute("Name");
myTxtView.bindText(nInfo);
Here the view contained DefaultTextView. It works
Thanks & Regards,
Aayush
Message was edited by: Aayush Dubey
When perform dynamic binding to UI element you have to work with metadata (*Info) objects.
So it should looks like: (wdDoModifyView)
if (!firstTime) return;
final IWDAttributeInfo aiName
= wdContext.getNodeInfo()
.getChild("Employees")
.getAttribute("Name");
final IWDInputField editor = (IWDInputField)
view.createElement(IWDInputField.class, null);
((IWDUIElementContainer)view.getRootElement())
.addChild(editor);
/* Or get existing view element instead of above */
editor.bindValue(aiName);
VS
Hi,
You can always verify this by using the statement
wdContext.getNodeInfo().getChild("").getAttribute("Name");
Regards, Anilkumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Your code creates a context attribute to a Context node. It returns an object of IWDAttributeInfo I suppose.
The IWDAttribute is an interface for the WebDynpro Context Attribute.
Hope MyNode is of type IWDNodeInfo.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.