cancel
Showing results for 
Search instead for 
Did you mean: 

How to use DateNavigator

0 Kudos

Hello everybody,

can anybody tell me how to make use of the DateNavigator UI element? I'm looking for code examples or a tutorial.

Thanks,

Christian

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Christian,

i'm afraid, there is no tutorial using it available so far. The most comprehensive documentation i found is available in the NWDS help (and an identical one in help.sap.com), if you search for the terms "Web Dynpro DateNavigator IWDDateNavigator".

So i suggest to build a sample application and to return to the forum, if you run into problems. Usage is not that complex IMHO.

Hope that helps.

Best regards

Stefan

@Pran & Vishnu: The DatePicker (control) is <b>not</b> the DateNavigator (UI element) as you both know for sure already

Former Member
0 Kudos

Hi Stefan

I didnt know that...

😛

I need more smileys here (one for slap on ones own face)

Regards

Pran

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Christian,

I have attached the code snippet that might help you. Put this code in wdDoModifyView method in the view.

IWDTransparentContainer root = (IWDTransparentContainer)view.getRootElement();

if(firstTime){

IWDDateNavigator dn = (IWDDateNavigator)view.createElement(IWDDateNavigator.class, "Date_Navigator");

dn.setFirstSelectedDate(new java.sql.Date(2004-01-01));

dn.setMonthsPerColumn(2);

dn.setMonthsPerRow(2);

dn.setLastSelectedDate(new java.sql.Date(2004-12-31));

dn.setSelectionMode(WDDateSelectionMode.SINGLE);

root.addChild(dn);

}

Also, thanks to Stefan in pointing out that Date Picker and Date Navigator are different. I thought both of them meant the same UI Element.

Thanks and Regards,

Vishnu Prasad Hegde

0 Kudos

Thank you all, the NW04 documentation on help.sap.com was very helpful.

Regards,

Christian

Former Member
0 Kudos

In NetWeaver Developer Studio, you can get help for a UI element as follows:

- in any view designer palette: right-click on a UI element icon

- in the Outline view: right-click on tree node, choose context menu "Show help".

Armin

Former Member
0 Kudos

Yes, of course. This is much more convenient.

Thx Armin.

Former Member
0 Kudos

Hi Christian,

As mentioned by Pran, this is how you use DateNavigator:

<u>If you want to use it statically:</u>

1) Create a value attribue in the view context. Let its type be "Date"(you can set this in the properties for this value attributes.)

2) Create an InputField. In the Element properties of this InputField Element, bind the "value" property to the value attribute that you just created. You are done...

<u>If you want to use it dynamically:</u>

1) Create a value attribute in the view context. Say, its name is "Val1"

2) in "wdDoModifyView" of the view, create the input field dynamically and bind its value to the value attribute in the context.

IWDTransparentContainer root = (IWDTransparentContainer)view.getRootElement();

if(firstTime){

IWDInputField ip1 = (IWDInputField)view.createElement(IWDInputField.class, "UI_Test"); //Here "UI_Test" is just a Unique Identifier

ip1.bindValue("Val1"); //here bindValue(String path) is used

/**** Note that path represents path in the context. Suppose, you had created value attribute "Val1" as the child of a node, say "Node1", then the parameter for the above method would be "Node1.Val1" ****/

root.addaddChild(ip1);

}

Former Member
0 Kudos

Hi

I assume if you define your value attribute to be of the type date and bind you input field to that attribute then it automatically comes with a date picker.

Regards

Pran