on 03-15-2005 6:53 PM
Hi experts.
Here is my problem.
I have a table with x rows and y columns. Each cell is an inputField. I would like to create a validator for each cell so that when enter is clicked, the action would validate the content entered. But without validating the rest of the row.
Since the columns are added dynamically, I cannot simply create an action for each column. I have no problems retrieving the current row being validated, but I can't figure out how to get the column. Is this available through the wdEvent? How do I do this?
Is there another smart way of doing this?
You could use a common (dispatch) action for all "InputField.onEnter" events. Using event parameter mapping, the table column ID may be passed to the action handler.
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Tomas,
Try to describe Armin`s suggestion more detailed:
1) Create action ("Action") in view with one string parameter ("id")
2) Assign action to all your columns:
public static void wdDoModifyView(IPrivateTestView wdThis, IPrivateTestView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
{
final IWDAction onAction = wdThis.wdGetActionAction();
final IWDTable table = (IWDTable)view.getElement("MyTableID");
final IWDTableColumn[] columns = table.getColumns();
for (int i = 0; i < columns.length; i++)
{
final IWDTableColumn column = columns<i>;
final IWDTableCellEditor cellEditor = column.getTableCellEditor();
if (cellEditor instanceof IWDInputField)
{
final IWDInputField inputField = (IWDInputField)cellEditor;
inputField.setOnEnter( onAction );
inputField.mappingOfOnEnter().addParameter( "id", inputField.getId());
}
}
}
3) Implement validation logic in public void onActionAction(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, java.lang.String id )
Regards, Maxim R.
It works as described.
Thank you experts, points for everyone!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.