on 04-11-2007 7:36 AM
anyone can tell how to bind (key,value) to the context of CheckBoxGroup.
For example: i have a node(named xNode) and its value attribute(xType),and bind it to the checkBoxGroup' <b>texts</b> attribute in my view.
I hope i can got following result by the following code.
<u><i>("A","OPEN") ,("B","CLOSE").</i></u>
this is to say,I need to got the real value "<i>A</i>" when "<b>OPEN</b>" is selected."<i>B</i>" value is for "<b>CLOSE</b>" selected.
<b>List list=new ArrayList();
for (int i = 0; i < wdContext.nodeXNode().size(); ++i) {
if (wdContext.nodeXNode().isMultiSelected(i)) {
// do something
String temp=wdContext.nodeXNode().getXNodeElementAt(i).getXType()
list.add(temp);
}</b>
The CheckBoxGroup does not use key/value-pairs (see Javadoc). It uses a context node (cardinality 0:N, selection 0:N) and an attribute A that stores the texts.
Just use a second attribute B for storing a key.
Example:
Context:
Items (node, card=0:N, selection=0:N)
-- Text (attribute, string)
-- Key (attribute, string)
Binding:
CheckBoxGroup.texts -> Items.Text
Create items:
{
IItemsElement item = wdContext.nodeItems().createItemsElement();
wdContext.nodeItems().addElement(item);
item.setKey("A");
item.setValue("Open");
}
{
IItemsElement item = wdContext.nodeItems().createItemsElement();
wdContext.nodeItems().addElement(item);
item.setKey("B");
item.setValue("Close");
}
Get selection:
for (int i = 0; i < wdContext.nodeItems().size(); ++i)
{
if (wdContext.nodeItems().isMultiSelected(i))
{
String selectedKey = wdContext.nodeItems().getItemsElementAt(i).getKey();
}
}
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.