Skip to Content
avatar image
Former Member

get lastSelectedDate in DateNavigator

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Apr 05, 2006 at 09:50 AM

    Jose,

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

    VS

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 05, 2006 at 09:50 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 05, 2006 at 10:18 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 05, 2006 at 10:59 AM

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

    Regards

    Add comment
    10|10000 characters needed characters exceeded