on 06-17-2009 5:59 AM
Hi,
I have a testedit UI field in my view with data and edit button also there down of the textedit.now when i clicked edit button the cursor should be displayed in the textedit filed.Can anybody give me idea regarding this.
With Regards,
Prasad
Hi,
The solution by Pravesh Verma should work fine.
Check the parameters(id of text edit, etc..) that you have mentioned are proper and correct.
AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sarbjet,
I had tryed your code but still it not showing the focus.Any thing else i need to do ..
Thanks,
Prasad
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Srinavas,
I assigend value attribute which is realted to model attribute to UI element.I am enter text at runtime also and i created VIEW of type IWDVIEW.I dontknow where the problem occuring.
With Regards,
Prasad
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Prasad,
Even if you are binding the TEXT EDIT ui element to a model attribute coming from the backend
Still you can use the method suggested by me to get the focus
You just need to get the attrinute info that particular attrinute
and in the eventhandler write the followin code
public void onActionEDIT(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionEDIT(ServerEvent)
IWDAttributeInfo attrinfo = wdContext.nodeReturn().getNodeInfo().getAttribute(IPrivateTESTView.IReturnElement.MESSAGE);
wdThis.wdGetAPI().requestFocus(wdContext.currentReturnElement(),attrinfo);
//@@end
}
here i am attribute message from the return node which is a model attribute and i am getting it fromthe backend
and its working fine for me
thanks
Sarb
HI krishna,
Actually in that textedit UI element i am displaying data which is coming from backend.So i assigned model attribute to that TextEdit element.The value attribute VIEW of type IWDVIEW is not assiged to that TextEdit field.May be this is the problem i think.Can you tell me alternate solution
Thanks,
Prasad
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You need not to bind the Context attribute "View" of type "IWDVeiw" to the UI element. This context attribute is to store the static view instance.
I dont think the model attribute is a problem.
Just confirm me. Is it displaying in editable mode. I mean can you enter some data at runtime into that UI element?
Can you just try binding an value attribute instead of model attribute to "Value" property of that UI element?
Regards,
Charan
Hi,
Pls try as Parvesh said. 100% It works.
-->Before this check that you binded the String type context attribute to value property of TextEdit UI element.
--> ReadOnly should be false.
public static void wdDoModifyView(IPrivateTestView wdThis, IPrivateExportToExcelView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
{
//@@begin wdDoModifyView
if(firstTime)
{
wdContext.currentContextElement().setView(view);
}
}
In the edit button action:
IWDView view = wdContext.currentContextElement().getView();
IWDTextEdit textEdit = (IWDTextEdit)view.getElement("TextEdit1");
textEdit.requestFocus();
How to get the Id of the TextEdit UI element.
Go to the properties of the UI element --> Get from Id property.
Regards,
Charan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
In the DoModifyView Give the below code and try if the curser is coming to the textedit, by default
textEdit.requestFocus();IWDTextEdit textEdit = (IWDTextEdit)view.getElement("TextEdit");
textEdit.requestFocus();
if not, click on the TextEdit and confirm the curser is coming,
Let me know the results then.
AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anoop,
I hae mentioned the correct textedit UIelement ID.But its not working.
my id name is TextEdit and i mentioned the same but noresult.
Can yu please give me idea reagarding this.
With Regards,
Prasad
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Praveen,
i have used your code in my application but its not working.Cursor not showing in testdit filed
With Regards,
Prasad Kamina
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hello prasad,
To set the cursor focus on the text edit on click of the button edit, do the following
1. bind the UI element Text Edit to one context attribute (suppose it is a value attribute bound
directly to context root node named
source )
2. create an action for the click event of the Button EDIT (suppose its name is EDIT)
This will create an eventhandler OnActionEdit() in the implementation.
3. Now write the code in the event handler as shown below
//@@begin javadoc:onActionEDIT(ServerEvent)
/** Declared validating event handler. */
//@@end
public void onActionEDIT(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionEDIT(ServerEvent)
IWDAttributeInfo attrinfo = wdContext.getNodeInfo().getAttribute(IPrivateTEST_appView.IContextElement.SOURCE);
wdThis.wdGetAPI().requestFocus(wdContext.currentContextElement(),attrinfo);
//@@end
}
4. deploy and run
done
Hope it is clear
Sarbjeet Singh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Prasad,
You can use the following code on the event of the edit button,
IWDAttributeInfo attribute= wdContext.getNodeInfo().getAttribute(IPrivate<ViewName>.IContextElement.<AttributeName>);
wdThis.wdGetAPI().requestFocus(wdContext.currentContextElement()<or the node>, attribute); //Sets the Focus on input Field/ Text edit depending on the attribute to which UI element it is bind
Please revert back in cae you have any queries.
Regards,
Ardhendu Sarkar.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Prasad,
Follow these steps:
1) Create a attribute in the context named view of type IWDView.
2) Write following code in the wdDoModify Funtion:
if(firstTime){
wdContext.currentContextElement().setView(view);
}
3) Now use following code in the onActionEvent of button:
IWDView view = wdContext.currentContextElement().getView();
IWDTextEdit textEdit = (IWDTextEdit)view.getElement("TEXTEDIT_ID");
textEdit.requestFocus();
This will take your cursor to the text edit box.
I hope this solves the issue. Please revert back incase you need further help on this.
Thanks and Regards
Pravesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.