cancel
Showing results for 
Search instead for 
Did you mean: 

Get Current month selected in date Navigator

Former Member
0 Kudos

Hi experts,

I am trying to use date navigator UI. I want to capture current selected month in the date

navigator UI. I tried doing it through parameter mapping with no success. Can anybody tell me an easy way to get current selected month in the date navigator UI .

Thanks in advance

Abhay

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

What exactly did you try and what does not work?

You can get the selected month either from the selected date (firstSelectedDate property) or by mapping event parameter IWDOnMonthSelect.MONTH to an integer attribute.

Armin

Former Member
0 Kudos

Hi armin

Thanks a lot for reply . I have craeted navigator UI . then I created an action and attached it

to action MonthSelect. But I am not sure how to add event parameter in the WDdo modify view.

I have put like this in wddomodify()

IWDDateNavigator DATE = (IWDDateNavigator) view.getElement("DateNavigator");

DATE.mappingOfOnMonthSelect().addSourceMapping("IWDOnMonthSelect.MONTH","month");

Kindly let me know the correct way .

Abhay

Former Member
0 Kudos

IWDDateNavigator dn = (IWDDateNavigator) view.getElement("DateNavigator");
dn.mappingOfOnMonthSelect().addSourceMapping
  (IWDDateNavigator.IWDOnMonthSelect.MONTH,"month");

Armin

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Kishan

I did not paste code here. I typed it here, hence i missed one ",". But problem wasn't this otherwise it would have given me an exception. I messed up with action type of date navigator , now I fixed it.

Thanks for reply .

Abhay

Former Member
0 Kudos

Hi armin ,

I have paste same code in wddomodify view, and at design time I created an action onMonth select with parameter "month". then after I tried to print this parameter in the action's event handler , but its blank .

Do modify view()

{

IWDDateNavigator dn = (IWDDateNavigator) view.getElement("DateNavigator");

dn.mappingOfOnMonthSelect().addSourceMapping

(IWDDateNavigator.IWDOnMonthSelect.MONTH,"month")

}

public void onActionMonthSelect(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, java.lang.String month )

{

//@@begin onActionMonthSelect(ServerEvent)

wdContext.currentContextElement().setDe("Selected parameter : "+month);

//@@end

}

Please let know where I am doing sily mistake.

Thanks

Abhay

Former Member
0 Kudos

Hi Abhay,


public void onActionMonthSelect(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, java.lang.String month )
{
//@@begin onActionMonthSelect(ServerEvent)
wdContext.currentContextElement().setDe("Selected parameter : "+month);
//@@end
}

What's this??? You can't use System.out.println() logic here. Use this code to set your context attribute,


wdContext.currentContextElement().setDe(month);

You can use this code to print what to need to,


wdComponentAPI.getMessageManager().reportSuccess("Selected parameter : ", +month);

Regards

Kishan

Former Member
0 Kudos

Hi,

Where are u calling your onmonthselect action? Are you calling in a Button?

Regards

Raghu

Former Member
0 Kudos

The action parameter should have type "integer".

Armin