cancel
Showing results for 
Search instead for 
Did you mean: 

get lastSelectedDate in DateNavigator

Former Member
0 Kudos

Hi, i have a problem with dateNavigator, i need to get the date selected when clicked in a day in the control.

in the properties of the control i bind the onDaySelect to a function, when i clicked in a day in the control, the function execute it, but i don't know how can i get the date selected, the function i create is this:

public void onActiononDaySelect(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, java.sql.Date Day )

{

//@@begin onActiononDaySelect(ServerEvent)

wdThis.wdGetExc_NavigationController().wdGetContext().currentContextElement().setTextoCabecera("Actualidad " + Day.toString());

//@@end

}

but the date is passed is null, so something is wrong, can you tell me how to get the date selected.

thanks a lot

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Jose,

Why not just bind firstSelectedDate / lastSelectedDate to context attributes and then use them in action handler?

VS

Answers (3)

Answers (3)

Former Member
0 Kudos

thanks for the help, i solved the problem binding atribute context to a lastSelectedDate.

Regards

Former Member
0 Kudos

Hi Jose,

You can use this code in wdDoModifyView.Here DateNavigator1 is the id of DateNavigator UI element.

if(!firstTime)

{

IWDDateNavigator date = (IWDDateNavigator)view.getElement("DateNavigator1");

wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("Date Selected" + date.getFirstSelectedDate());

}

date.getFirstSelectedDate() will get you the selected date.

Regards,

Rajeev

Former Member
0 Kudos

To pass the event parameter value to the action handler parameter, you have to define a parameter mapping.

IWDDateNavigator dn = (IWDDateNavigator) view.getElement("ID-of-DateNavigator");
dn.mappingOfOnDaySelect().addSourceMapping
(
  "day", /* name of event parameter */
  "Day", /* name of action parameter */
);

Armin

P.S: Valery's proposal is probably better

Message was edited by: Armin Reichert