cancel
Showing results for 
Search instead for 
Did you mean: 

default selection of radio buttons in a table

former_member187658
Participant
0 Kudos

Hi

I have a table which has 3 columns of radio buttons. I want to set one as the default selected one. The radio buttons selected kye property is linked to the sub node of model node. its cardinality is 1:1.I tried doing it through the supply functions, but it throws an error for the cardinality.

I wrote the following piece of code in the wdModifyView(), but again the same error is displayed




if (firstTime)
    {
    
    int size = wdContext.nodeCmpNode_UserRights().size();
    IPrivateAssign_AuthenticationView.ICmpNode_UserRightsNode userright_node = wdContext.nodeCmpNode_UserRights();
    
	IPrivateAssign_AuthenticationView.INode_AuthorizationNode node = null;
	IPrivateAssign_AuthenticationView.INode_AuthorizationElement element = null;
	
    for(int i = 0;i<size;i++)
    {
    	node = userright_node.nodeNode_Authorization();
		element = node.createNode_AuthorizationElement();
	element.setAuthorization("Read");
	node.addElement(element);
	
    }
    }

I changed the cardinality to 0..n, but in this case only the first row comes as enabled with default radio button marked. For 1..n all the rows are enabled but no radio buttons are marked default.

Can someone please suggest in this regard.

Thanks & regards,

Anupreet

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello,

Set the singleton property of the Sub Node (Value Node) to <b>false</b> and cardinality to 1:1.

Under the Sub Node, create a value attribute "SetRadio" (datatype: String) and bind it to the <i><b>selectedKey

</b></i> property of the radio button <i>column1</i>.

Similarly, create a value attribute "DontSetRadio" (datatype: String) and bind it to the <i><b>selectedKey

</b></i> property of the radio button <i>column2</i>.

Then write the supply function to set the default selection for a specific column.

A pointer code is shown below.


 public void supplyRadio(IPrivateTable_OVSCompView.IRadioNode node,  
IPrivateTable_OVSCompView.IUserListElement parentElement)
  {
    //@@begin supplyRadio(IWDNode,IWDNodeElement)

	IPrivateTable_OVSCompView.IRadioElement 
                   radioElem = node.createRadioElement();
        /*
         * Set the default radio button column to be selected
         */
	
        radioElem.setSetRadio(null);
        /*
         * Blank out other radio button columns
         */
	
        radioElem.setDontSetRadio("gbhjd");
	parentElement.nodeRadio().addElement(radioElem);
    //@@end
  }

Bala