on 02-01-2007 8:59 AM
I wanna create a dynamic tree. In my application there are 3 views in a ViewSet. One view "Tree" with GuiElement tree , another view "Question" contains a inputfield for typing a question. with Button go to view "SubQuestion" for select its relative parent. another button for new Question. the 3. view "SubQuestion" contains a table.
When i types a question in "question" view and click "new Question"button, then automatic insert a node in "tree"View.
three views : "Question" ,"Tree" , "SubQuestion"
all controllers are already mapped.
Context: for ComponentController and 3 ViewController
- Question (node)
-
Text (attribute, string)
-
SubQuestion (recursive node, RepeatedNode = Question)
Question (Node)
--cardinality 0..n
--collectionType list
--initializeLeadSelection true
--selection 0..1
--singleton true
--typedAccessRequired true
"Question" View Layout:
ChooeParentButton.OnAction = ToSubQuestion ---(jump to "SubQuestion" View for choosing the parent, i.e )
NewQuestionButton.OnAction = NewQuestion --- create a new node element ,i.e create a new question
InputField.value = QuestionText
"SubQuestion" View Layout: (This view contains a table with a column "Question.Text". all questions stand in this table. i will select a question als parent)
--- Table.dataSource = Question
--- Table.onLeadSelect = Select ( back to "QuestionView" and i hope, the current element is the new created subQuestion)
--- one Column
-
TableCellEditor.Text = Question.Text
"Tree" View LayOut
--- Tree.dataSource = Question
--- TreeNodeType.dataSource = Question
--- TreeNodeType.text = Question.Text
Action "Select":
public void onActionSelect(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent,
com.sap.tut.wd.test1.wdp.IPrivateSubQuestionView.IQuestionElement selectedElement )
{
//@@begin onActionSelect(ServerEvent)
IPrivateSubQuestionView.IQuestionNode subQuestionNode = wdContext.currentQuestionElement().nodeSubQuestion();
IPrivateSubQuestionView.IQuestionElement subQuestion;
subQuestion = subQuestionNode.createQuestionElement();
subQuestionNode.addElement(subQuestion);
subQuestionNode.setTreeSelection(subQuestion);
wdThis.wdFirePlugBackQuestionOut();
//@@end
}
public void onActionSelect(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent,
com.sap.tut.wd.test1.wdp.IPrivateSubQuestionView.IQuestionElement selectedElement )
{
//@@begin onActionSelect(ServerEvent)
IPrivateSubQuestionView.IQuestionNode subQuestionNode = wdContext.currentQuestionElement().nodeSubQuestion();
IPrivateSubQuestionView.IQuestionElement subQuestion;
subQuestion = subQuestionNode.createQuestionElement();
subQuestionNode.addElement(subQuestion);
subQuestionNode.setTreeSelection(subQuestion);
wdThis.wdFirePlugBackQuestionOut();
//@@end
}
The Problem :
when i select a question als parent, jump back to "Question"View. I hope ,the current NodeElement is kind (SubQuestion), but in fact parent .
i don't Know, how set the LeadSelection or TreeSelection of recursive Node (Non-Singleton child node).
i think ,the problem is
subQuestionNode.setTreeSelection(subQuestion);
i can't set the recursive node element als current element.
can you give me some code.
Thx in Adcance.
regards
Yaning
Yaning,
I recommend you to (re-)read my blog post https://weblogs.sdn.sap.com/pub/wlg/1896. [original link is broken] [original link is broken] [original link is broken] [original link is broken] I've described here how to handle lead selection in recursive nodes. Also example is built using Table with master column exactly same technique is applicable to Tree.
Valery Silaev
SaM Solutions
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 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.