cancel
Showing results for 
Search instead for 
Did you mean: 

Toggle functionality in a table

Former Member
0 Kudos

Hi Friends,

I have a requirement where I have to perform Toggle functionality inside a table.

Say, there are 3 rows A,B,C in a table which can be selected by means of a radiobutton.

I select Row A, then I decide to select Row B. Here the radiobutton should automatically not be selected for Row A and Row C but should remain selected for Row B.

Any pointers on this would be really helpful.

Regards

Sheba

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Armin,

I am not clear on the implementation. How can this method getRowsIndex() help me to determine if the row is selected or not?

I have made use of the method in the following code.

int iSize = wdContext.nodeVn_Rows.size();

for (int iIndex = 0; iIndex < iSize; iIndex++) {

nodeEle = wdContext.nodeVn_Rows().nodeVn_RowsElementAt(iIndex);

i = getRowsIndex(nodeVn_RowsEle);

if(i != selectedRow.getLeadSelection()){

wdContext.currentContextElement().setVa_SelectedRowIndex("Selected");

}else{

wdContext.currentContextElement().setVa_SelectedRowIndex("Not selected");

}

}

Please help.

Regards

Sheba

Former Member
0 Kudos

Try this:


Context
+ selectedRowIndex (integer or string, not sure if integer works)
+ Rows (node, data source for table)
  + index (integer, calculated=true, read-only=true)

Use a RadioButton as table cell editor and bind the "selectedKey" property to attribute "selectedRowIndex" and bind "keyToSelect" to "Rows.index".

Implement the calculated attribute like


int getRowsIndex(IRowsElement element)
{
  return element.index();
}

Armin

Former Member
0 Kudos

Hi,

Forgot to mention that the above error occurred on action of the Event of radiobutton.

Regards

Sheba

Former Member
0 Kudos

Hi Jeetendra,

Thanks for your reply.

I know that this functionality is possible using checkbox. But I am unable to achieve the same through radiobutton.

Here the selectedKey property has a boolean attribute bound to it. The logic is similar to the one as you have mentioned.

But when I executed the application, got the following error :

java.lang.ClassCastException: class java.lang.String:null incompatible with interface com.sap.tc.webdynpro

.progmodel.api.IWDNode:service:tcwdwebdynpro......lloader.ResourceMultiParentClassLoader@28657778@alive

Is there something missing from my end that needs to be taken care of wrt setting of th radio button property?

Thanks and Regards

Sheba

Former Member
0 Kudos

Hi Sheba,

What you can do is on each selection of radio button you can fire an event (i.e by parameter mapping) and in that event check that if any other row radio button is selected or not if it is selected (i.e selection true) then un-check it(make it false).

I have achieved save functionality in our case and i doubt that you can use radio button for same function. i have used check box. Give it a try and let me know if you need any more assistance.

Regards

Jeetendra