on 04-24-2007 7:27 AM
Hi everyone, i have search this subject and find 2-4 thread,and i have followed this threads but still i cannot success completely. I will explain my problem. I have table like this
A | B |
111 | xxxx |
222 | yyyy |
333 | zzzz |
and I will show it as "
A | B |
o | xxxx |
o | yyyy |
o | zzzz |
| Ok | | Cancel | -> button OK and Cancel
o --> radio button
So when i click one of the radio button and I click Ok button I will send value 111 for xxxx, 222 for yyyy, 333 for zzzz,....
I have create context like this
-Table Proficiency (value node) caldinality 1...n singleton true
--RadioButton (value node) cardinality 0..1 singleton false
---KeyToSelect --> string
--CellDescription --> string (will show xxxx,yyyy,zzzz)
--Selected Key --> string (value 111,222,333)
My code like this :
public void wdDoInit()
{
initView();
}
private void initView()
{
IPrivateCompetencyHelpView.ICprofElement profElement = null; // model element
int size = wdContext.nodeCProfsize(); // model node that become source data
IPrivateCompetencyHelpView.ITableProficienyElement currentElement = null;
for(int i=0;i<size;i++)
{
profElement = wdContext.nodeCprof().getCprofElementAt(i);
currentElement = wdContext.nodeTableProficiency.createTableProficencyElement();
if (condition ...)
{
currentElement.setCellDescription(profElement.get...());
currentElement.setSelectedKey(profElement.get...());
wdContext.nodeTableProficiency().addElement(currentElement);
}
}
}
in supply function for radio button
public void supplyRadioButton(IPrivateCompetencyHelpView.IRadioButtonNode node, IPrivateCompetencyHelpView.ITableProficienyElement parentElement)
{
//@@begin supplyRadioButton(IWDNode,IWDNodeElement)
IPrivateCompetencyHelpView.IRadioButtonElement elem = node.createRadioButtonElement();
node.addElement(elem);
elem.setKeyToSelect(parentElement.getCellDescription());
//@@end
}
public void onActionClickRadioButton(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionClickRadioButton(ServerEvent)
for(int i=0;i<wdContext.nodeTableProficieny().size();i++)
{
if (i != wdContext.nodeTableProficieny().getLeadSelection())
{
wdContext.nodeTableProficieny().getElementAt(i).setAttributeValue("SelectedKey",null);
}
}
//String key = wdContext.nodeTableProficieny().currentTableProficienyElement().getSelectedKey();
//wdContext.currentContextElement().setHasil(key);
//@@end
}
My question is why i still can choose radio button more than one so if i click all radio button the all radio button is in condition clicked(X) and when I click, the value for column B is changed to from CellDescription become SelectedKey even i have binding column B to CellDescription ? Thank you
Regards,
Satria
satria,
I didn't check your code, only textual descriptions, but...
1. You are confusing KeyToSelect and SelectedKey. Every unique value of IWDRadioButton defined by KeyToSelect property. So bind IWDRadioButton.keyToSelect to attribute KeyToSelect and do not forget to populate this attribute with strings {111,222,333} rather then SelectedKey.
2. SelectedKey attribute must be shared across all radio buttons that form logical "radio button group". In your context design every radio button has unique SelectedKey, so you have one group with only one button for every table row. Hence you get incorrect behavior. You must move SelectedKey attribute outside table node (Proficiency and nested). It's better to turn it into direct attribute of root context node.
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.
Hi Valery, thank you for your answer. I "think" it works now (I don't know if there is problem _)
I change my context like this
-Root
--TableProficency
---RadioButton
-
KeyToSelect
---CellDescription (XXXX,YYYY,ZZZZ)
---CellRating (111,222,333)
- SelectedKey (I try your suggestion _)
I change my
void initView()
{
....
if condition
{
currentElement.setCellDescription(...)
currenctElement.setCellRating(...) --> 111,222
}
}
for my supply function for Radio Button
public void supplyRadioButton(IPrivateCompetencyHelpView.IRadioButtonNode node, IPrivateCompetencyHelpView.ITableProficienyElement parentElement)
{
//@@begin supplyRadioButton(IWDNode,IWDNodeElement)
IPrivateCompetencyHelpView.IRadioButtonElement elem = node.createRadioButtonElement();
node.addElement(elem);
elem.setKeyToSelect(parentElement.getCellRating()); --> GET 111,222,333
//@@end
}
OnActionClickRadioButton()
{
I Delete All _
}
OnActionOK() --> for OK Button
{
String key = wdContext.currentContextElement().getSelectedKey();
wdContext.currentContextElement().setResult(key); --> I bind this with TextView for debugging
}
And It works, Thanks _
Hai ,
your context look like
\--
|
NodeTable
|111(key)
|abc(desc).
|selected
bind this node to a table, create a new coloumn in table . select table cell editor as radio button . bind the property key to select of radio button is NodeTable.111
for selected key bind the attribute selected.
write an action for radiobutton onSelect.
in action write the code below
String key=wdContext.currentContextElement.getSelected();
String value=null;
for(int i=0;i<wdContext.nodeNodeTable().size();i++){
String k=wdContext.nodeNodeTable().getNodeTableElementAt(i).get111();
if(k.equals(key){
value=wdContext.nodeNodeTable().getNodeTableElementAt(i).getAbc();
break;
}
}
Regards,
Naga
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
is your table has only two columns or does it have more?
let me knw this , coz if it has just two columns then there is some better way that this.
regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Satrina,
that means you want to have just two columns in table , may be we say 1 will act as key(i.e. 111), and other column will act as description (i.e. XXX, and this desc should be shown while showing to user), I would suggest you to go for Extended value services, i.e., EVS.
Here we create simple type in dictionary, we then define a context attribute with this simple type as its datatype. Then a Input Field with this context attribute mapped to it will show a table in the form of value help, this table will show 2 columns + 1 lead selection col, 2 col: key column and desc column, though only desc is shown the key gets mapped while accessing.
please go through this link, I am sure it will solve you problem
https://www.sdn.sap.com/irj/sdn/downloaditem?rid=/library/uuid/391ee590-0201-0010-1c89-f1193a886421
regards
Hi Abhijeet,
Thank you for your advice. I have thinks the same way you think before but i cannot do it. My client want like this.
Here is my flow. There is iView that show table
A | B | C |
| xxx | 111 | 222
I need to change value in column B and column C, and before I think I will use EVS but client like to using LinkToAction. When this LinkToAction is clicked, this will popup window (with column A as parameter input) that show table with radiobutton (TableProficiency), when button OK clicked, selectedKey will be thrown to previous IView to change clolumn A and column B. So how with my radio button that still not correct ?
Hi,
I understood the problem i.e. it is letting you to select more than one radio button and that consequently creating whole mess(correct me if i am wrong).
Unfortunatly, in tables, we cant have RadioButtonFroupByIndex(index coz you data is coming from backend). To achieve you purpose, you need to have radioButtonGroup, but in table you can only have RadioButton. Even if you go for Form(In apply template), i think you wont have RadioButtonGroup UI element.
The solution I thought, is to have 1 Group UI element, in that you can have radioButtonGroupByINdex with a input field to show the desc in popup.
hope it helps
regards
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.