on 09-04-2008 7:55 AM
Hi Experts
My Problem is i need 2 RadioButtons in a Table.so i have inserted 2 RadioButtons (Accept & Reject)in
cellEditor and i have binded those values to the boolean value which is coming from the BackEnd
.but my problem is i can select both the radiobuttons and on selecting it is showing an error
is Not A Valid value.but i need only one radio button to be selected for a row.How can i get this?
Regards,
Asif
hi ...
Your inserting two radio buttons in a row of a table ,one radio button for one column...
Since you cannot use RadioButtonGroupByIndex in a table column as a table Cell Editor ....
You can follow this
take two attributes in the context as b1 and b2 of type boolean.
Bind this attributes to the radiobutton enable property
for example
b1---for enable property of Accept radio button
b2 -- for enable property of Reject Radio button.
Take two actions for two Radiobuttons
In the onSelect action of the Accept radio button you write as below
wdcontext.currentcontextelement.setb1(false);
In the onSelect action of the Reject radio button you write as below
wdcontext.currentcontextelement.setb2(false);
in wdinit() write as follows
wdcontext.currentcontextelement.setb1(true);
wdcontext.currentcontextelement.setb2(true);
hope it helps
If any queries reply back
Regards
Madhavi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for reply
I have created a value node with a cardinality1:1 and selection as1:1 with the attributes
1.accept
2.reject
in init() method im writing this code
wdContext.nodeElement().currentElementElement().setAccept(true);
wdContext.nodeElement().currentElementElement().setReject(true);
on deploying the application it is giving null pointer exception.what to do
Hi every one
i got the solution with small problem
we have to create our own attributes of type string
say 1.accept-string
2.reject-string
for accept give keyToSelect value as "a" and for reject as"r"
bind the selectedKey to corresponding attribute
now onSelect write this code
public void onActionaccept(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionaccept(ServerEvent)
if(wdContext.currentContextElement().getAccept()=="a")
{
wdContext.currentContextElement().setReject(null);
wdContext.nodeTable().currentTableElement().setAccept(true);
}
similar thing for reject also
but the thing is that
now im able to select only one button at a time but if i select accept corresponding all accept buttons of rows get selected as im getting data from backend ....please some one guide me what to do
I forgot to say that the value node must be non-singleton (singleton=false) such that it exists for every parent node element (table row).
Say you have the following context structure:
Rows (node, c=0:n, s=0:n)
-- Selection (node, c=1:1, s=1:1, singleton=false)
---- value (string)
Add two table columns "AcceptColumn" and "RejectColumn", and add two RadioButtons "AcceptButton", "RejectButton" as cell editors. Bind the "selectedKey" property of both radio buttons to attribute "Rows/Selection/@value". Further assign an action (at least a dummy action) to both buttons.
Now, to initialize the values for the table rows, write code like
for (int i = 0, n = wdContext.nodeRows().size(); i < n; i++)
{
IRowsElement row = wdContext.nodeRows().getRowsElementAt(i);
/* this line defines which radio button should be selected in the row at index i: */
row.currentSelectionElement().setValue("accept"); /* or "reject" */
}
To check the value of the radio buttons in row at index i:
IRowsElement row = wdContext.nodeRows().getRowsElementAt(i);
String value = row.currentSelectionElement().getValue();
if ("accept".equals(value))
{
}
else if ("reject".equals(value))
{
}
else
{
/* null or illegal value */
}
Armin
Hi,
Use radiobuttongroupbykey.Create simpletype and create Accept and Reject in Enumeration by giving value fields 1 and 2.
Now in cintext create one value node and in it create value attribute.
To this attr assign simple type.
Now in layout ,to this radiobutton ,assign this value attribute to selected key property.
Go to the implementation and inside init method wrie down
wdContext.currentCtx_vn_radiobuttonElement().setCtx_va_rdb("1");
so that it will set selected the fisrt radio button.
Now before executing RFC write down the code:
If you are getting first radio button selected then in RFC give that perticular value as "X" and at the same time give other value as blank "".This will not let both the buttons selected.
if (wdContext.currentCtx_vn_radiobuttonElement().getCtx_va_rdb().equals("1"))
{
wdContext.current<backendnode>().set<modelatrr1>("X");
wdContext.current<backendnode>().set<modelatrr2>("");
}
if (wdContext.currentCtx_vn_radiobuttonElement().getCtx_va_rdb().equals("2"))
{
wdContext.<backendnode>().<modelatrr2>("X");
wdContext.current<backendnode>().set<modelatrr1>("");
}
and then execute RFC.
Hope it will help.
Regards
Prajakta
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Use RadioButtonGroupByIndex.
thanks & regards,
Manoj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
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.