on 02-04-2009 1:28 PM
Hi all,
Well can anybody plz tell me how to go to new row in table control of webdynpro.Basically i want to use onEnter on Input field UI inside a table column so that it shud go to new row in the table .
Regards:
Hanif
answered
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi shaikh,
Let me first understand your requirement.
"When an Input Fields onEnter is been fired, row to the next should be selected"
//@@begin onEnterInputField(ServerEvent)
int lead = wdContext.nodeTable().getLeadSelection();
int size = wdContext.nodeTable().size();
if( lead < ( size - 1))
wdContext.nodeTable().setLeadSelection( lead + 1);
//@@end
nikhil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi nikhil i tries same again but the error is.......
The initial exception that caused the request to fail, was:
java.lang.NullPointerException
at com.sap.tc.webdynpro.progmodel.view.ContextBindingManager.getViewElementViaEditablePropertyBinding(ContextBindingManager.java:89)
at com.sap.tc.webdynpro.progmodel.view.View.requestFocus(View.java:420)
at com.sap.videocon.GridtableView.onActiononEnter(GridtableView.java:221)
at com.sap.videocon.wdp.InternalGridtableView.wdInvokeEventHandler(InternalGridtableView.java:153)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)
... 25 more
See full exception chain for details.
Hi nikhil one more thing i wud like 2 ask u..i..e..If thr r 2 rows insertted and now i want one more row to be inserted/added between these two rows how to achieve this using the action of getLeadSelection of the table so that exactly a row shud be added between these updated rows during runtime..
Waiting for reply...
Regards:
hanif
hi nikhil reolve the using the code......
node.addElement( lead , element);
but the problem is wen i am selecting first row for leadselection upside rows are added and wen click to second row leadselect thn it is coming in between..
So how to resolve for the upcoming added rows for leadselect rather in between rows
Resolve the issue of lead selection between the two rows..
Well i want ask about tree in table control..hope u shall guide in this..
I want to add child node to the parent node at runtime..Basically i hav 5 attributes ProjectName,ProjectTask,ProjectUser,ProjectStartDate,ProjectEndDate..
Now i want to add these 4 attributes under ProjectName at runtime.
And after adding the attributes each attribute shud be in thier respective columns.
At runtime i want to make this provision of tree structure in the table control.
Hope u undertstand and anwser these one also..
Waiting for reply
Regards:
Hanif.
Hi Shaikh,
For the cursor to go to the next cell WDViewController.requestFocus(IWDNodeElement, IWDAttributeInfo)
is the only option that I am aware of.
When using the above api where are you getting null pointer exception?
The method that Nikhil mentioned will work only on leadselected row. You will have to get the row in which the cursor is currently. Do the following.
You want to get the node element (table row) in which the onEnter event of the input field (cell editor) "Editor" has been triggered:
Add a parameter "element" of type IWDNodeElement to the action "Action" assigned to the onEnter event.
Define a parameter mapping in wdDoModifyView():
if (firstTime)
{
IWDInputField editor = (IWDInputField) view.getElement("Editor");
editor.mappingOfOnAction().addSourceMapping
(
"nodeElement", /* name of (implicit) event parameter */
"element" /* name of your action parameter */
);
}
So at runtime your onEnter action handler will get the parameter element which is the current row the cursor is in now.
Assume you have 8 columns. You will have to create 8 different onEnter Actions because there in no other way to find out in which column the user clicked. In the implementation of the onEnter event of a particular column you should have the attributeInfo of the next column.
get the attributeInfo in this way
wdContext.getNodeInfo().getChild("Name").getChild("Name1").getAttribute("hardCodeAttributeName");
Don't forget to follow the context hierarchy to get to the node containing the attribute. If you use wdContext.nodeProject().getNodeInfo() if the node Project is empty you could possibly get a null pointer exception. The other way doesn't depend on data. See my [post|] explaining why.
Once you have the attribute info and the element in which the cursor is in now you can go ahead and call the request focus api.
wdThis.wdGetAPI().requestFocus(element,attr);
Make sure that from the last column you have to go to the first column of the next line. So get the next node Element
if(element.index() < element.node().size()){
element = element.node().getElementAt(element.index()+1);
}
Let me know if you have any problems with this.
Sanyev
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shaikh,
Your requirement is to go to a new line when the user does an enter on a table field right?
Your onEnter action handler of the table column should do the following.
First you have to create a new row in the table. On the context node which is bound to the table you need to create and add a new element.
IWDNodeElement element = wdContext.nodeTable().createElement();
wdContext.nodeTable().addElement(element);
There might be cases where the newly created row is not visible to the user. So you need to make the newly created row visible. For that you can set the property setFirstVisibleRow(int value) of the table dynamically.
You will not have access to the table UI element directly from your action handler. You will have to store your table in a publicly accessible place and then from your action handler modify the firstVisibleRow property of the table.
Even though all they are possible I would still recommend you to use a button in the toolbar for creating a new row instead of using onEnter event.
@Gayathri -- The link you have provided is for ABAP tables.
Regards,
Sanyev
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi sanjeev thanx for reply. Well I have seen the pdfu2019s already but I am not the real stuff which I want. Basically I have binded the table to the context consisting 50 rows and each cell of the table is having Input field control so as to create a excel type of form in this webdynpro iView.
My requirement is to a workbench in which on each OnEnter action control shud go frm one cell to other or frm one row to other one.
I hav to make an application like MS Project Server 2007 if u hav seen.
Plz reply ASAP if u knows how to resolve this.
Waiting anxiously.
Regards:
hanif
Hi Hanif,
If I am correct your requirement is not to create a new row but just to set the focus to the next column right?
if that is the case you can check this method IWDViewController.requestFocus(IWDNodeElement, IWDAttributeInfo). See [API|http://help.sap.com/javadocs/NW04s/current/wd/com/sap/tc/webdynpro/progmodel/api/IWDViewController.html#requestFocus(com.sap.tc.webdynpro.progmodel.api.IWDNodeElement, com.sap.tc.webdynpro.progmodel.api.IWDAttributeInfo)]
From the action handler on onEnter get the nodeElement and then use the above API to set the focus to the appropriate attribute.
Let me know if you need more info.
Regards,
Sanyev
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 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
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.