cancel
Showing results for 
Search instead for 
Did you mean: 

How to add unique id to check box in a table

chinna_babu2
Active Participant
0 Kudos

Hi Experts,

I have a static table in which more than 500 records appears in the table, so vertical scroll is displaying in the table. In each row, check boxes and text boxes displays with the data. When the check box is selected, I will do the calculation based on the selected check box and displays the calculated value to text control of respected row. To achieve this, I am triggering the event iterating the loop over the context to find which check box is selected. When the page gets refreshed, cursor moves to first record.

Since all the check boxes having the same id, I am not able to get from which check box this event has got triggered.

Is there a way to assign unique id to each check box so that I can assign parameter to the control and get from which check box event got triggered. I have tried to generate the table dynamically, even there I couldn't assign id to each check box.

Please through light on this request

Thanks

Murthy

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You can identify the table row using event parameter mapping.

Add an action parameter "row" of type I<DataSourceNode>Element to the action for the "onToggle" event and define an event parameter mapping "nodeElement" -> "row".

This will give you the context node element corresponding to the table row where the checkbox has been toggled.

Answers (2)

Answers (2)

chinna_babu2
Active Participant
0 Kudos

I am setting the focus by getting the context attribute and calling request focus

IWDAttributeInfo attributeInfo = wdContext.node<ContextNode>().getNodeInfo().getAttribute("attribname");

wdThis.wdGetAPI().requestFocus(wdContext.node<ContextNode>().get<ContextElement>at(leadselection), attributeInfo);

0 Kudos

Hi Murthy,

if it is webdynpro application then in the check box action get the leadselection of that table( context node which is binde to that table) and then write your code to populate the values in text fileds in the same row based on condition.

sample code:

To get Lead Selection: int i = wdContext.node<NodeName>().getLeadselection();

To populate the data on same row:

wdContext.node<NodeName>().get<NodeName>ElementAt(i).set<AttributeName>("< EnterValue>");

hope this will help you.

Thanks & Regards,

Bharagva.

chinna_babu2
Active Participant
0 Kudos

Hi,

Thanks for the reply. Through the lead selection I am able to get the check box selection. Is there any away to focus the cursor on the row where check box checked or unchecked.

Thanks

Murthy

Former Member
0 Kudos

My solution works without changing the lead selection when the check box is pressed (which is the default behaviour in newer releases). Changing the lead selection on interaction with a cell editor may be a performance issue.

Former Member
0 Kudos

It seems this is not the behaviour at least in CE 7.2

I also want to set as selected the row where a checkbox is toggled..

What can i do to achieve this now in CE7.2? The I<SourceNodeElement> row comes null now.

Any hint for this?

former_member185086
Active Contributor
0 Kudos

It is not specific to any platform but common in all whether is CE or 7.0 follow the given procedure

1. Create a common onLeadSelect of table say it selectedRow

2. Assign the same event in onToggle selectedRow of checkbox.

3. Now loop it in such a way that

	if (wdContext.nodeAppinvoiceData().getLeadSelection() >= 0)
		{
			wdContext.currentAppinvoiceDataElement().setIsPreviewSelected(true);

			if (wdContext.currentAppinvoiceDataElement().getIsSelected())
			{
				wdContext.currentAppinvoiceDataElement().setIsSelected(false);

				for (int i = 0; i < wdContext.nodeAppinvoiceData().size(); i++)
				{
					boolean flag = wdContext.nodeAppinvoiceData().getAppinvoiceDataElementAt(i).getIsSelected();

					if (flag)
					{
						break;
					}
					else
					{
					}

				}
			}
			else
			{
				wdContext.currentAppinvoiceDataElement().setIsSelected(true);
			}
		}

		wdContext.currentAppinvoiceDataElement().setIsPreviewSelected(false);
		wdContext.nodeAppinvoiceData().clearSelection();
		wdContext.nodeAppinvoiceData().setLeadSelection(-1);

BR

Satish Kumar

Former Member
0 Kudos

In newer releases like 7.20 the default behaviour should be to not change the lead selection when a check box cell editor is checked or unchecked. Do find out the table row where this happens you have to define an event parameter mapping as described above.