Skip to Content

How to use DateNavigator

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

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

5 Answers

  • Best Answer
    avatar image
    Former Member
    Aug 25, 2004 at 05:59 AM

    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 😉

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 25, 2004 at 12:40 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 25, 2004 at 04:41 AM

    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);

    }

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 25, 2004 at 09:01 AM

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

    Regards,

    Christian

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 25, 2004 at 10:31 AM

    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

    Add comment
    10|10000 characters needed characters exceeded