Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Table rows changed by user or not

I have a table with 5 rows.

Each row has an input field.

On page load the table will be populated with these inputs fields with saved data from the backend.

It will be editable for the user.

There is a save button per row so that user can save the changes per each row.

Now I want to display on action of a button all the changed and unsaved rows in this table.

I tried with isChangedByClient() method, and it returns true. But how will i reset for this for a particular row after save on that row?

Regards

BP

Former Member replied

Hi BP,

This is quite tricky one. Try this approach.

Do the source mapping in wdDoModifyView as below to the button UI element you created in column.

IWDButton button = (IWDButton) view.getElement("Your_Button_ID");
button.mappingOfOnAction().addSourceMapping("nodeElement", "element");

Then in the action of the button add that node element as arguement with arguement name as "element" (this is must - because we did the source mapping with the name "element" ) as below. We will get the index of the row which is changed or not using this nodeElement.

Now create a global parameter in the Begin Other and End. it is at the bottomof the code.

List<IWDNodeElement> changedList = new ArrayList<IWDNodeElement>();

This list will contain the changed element of the table.

Now in the action of Button, you can get the reference of all those elements which has been changed and which has not been changed. use the following code

public void onActionSave (com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, IPrivateTestView.ITestValuesNodeElement element )
  {
    //@@begin onActionSave(ServerEvent)

// NOTE: this function will be called only when you will hit the button in the column that means you have changed the value in the input field.
IWDNodeElement nodeEle = wdContext.node<Your_Node_Name>().getElementAt(ele.index());

// You have defined this changedList as the global parameter. All the changed element will be added to this list.
if(!changedList.contains(nodeEle)){
	  changedList.add(nodeEle);
}    
//@@end
}

I hope this solves the issue. Please revert back in case youhave any further issues.

Thanks and Regards,

Pravesh

Regards,

Charan

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question