on 08-05-2009 10:01 AM
Hi Experts,
I have created WD application. It contains DateNavigator. User clicks on a particular date. We want to display the clicked date. How we can do so? I have done following coding. What I should type after "hi" + ????? to display the selected date.
public void onActionSelectDate(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionSelectDate(ServerEvent)
wdComponentAPI.getMessageManager().reportSuccess("hi ");
//@@end
}
Regards,
Gary
Hi Gary,
You can do it in two ways:
1) bind the firstSelectedDate property of the Date Navigator to an attribute and then on your action (which can be a button click) you can retrieve the value of the same
2) or you can write an action method for event onDaySelect()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Create an attribute(dateSelected) of date type and bind it to the "firstSelectedDate" of the Date Navigator.
Create the below action & bind it to the onDaySelect() event of the Date Navigator.'
public void onActionSelectDate(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionSelectDate(ServerEvent)
wdComponentAPI.getMessageManager().reportSuccess("hi "+wdContext.currentcontextelement.getdateSelected());
//@@end
}
Regards
Shruti
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Gary,
You can do this by binding the context attribute of type date to the firstSelectedDate property of the datenavigator Ui element.
then suppose context attribute to which you have bound the UI element has the name date then create an action for the event onDaySelect. then write the following code in the event handler
public void onActionselectdate(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionselectdate(ServerEvent)
String str = wdContext.currentContextElement().getDate().toString();
wdComponentAPI.getMessageManager().reportSuccess("HI" + str);
//@@end
}
It will solve your issue.
But the date format here will be YYYY-MM-DD if you want to change it then either you have to use one simple type or modify it in the code itself by using some string operation.
Regards,
Sarbjeet
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
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.