cancel
Showing results for 
Search instead for 
Did you mean: 

Calendar

Former Member
0 Kudos

Hi,

     We have a calendar view with first day of the week as "Sunday" and last day as "Saturday".

How can we change the first day of the week as "Saturday" and last day as "Friday" programmatically using web dynpro java code.

Thanks and Regards,

Teja.

Accepted Solutions (1)

Accepted Solutions (1)

christian_santej
Active Participant
0 Kudos

hi Teja,

you can bind the "firstDayOfWeek" attribute of the DateNavigator to a context attribute (SimpleType = com.sap.ide.webdynpro.uielementdefinitions DayOfWeek). in your wdDoInit() method you can set this value. Example - the binded attribute is "dayOfWeek":


wdContext.currentContextElement().setDayOfWeek(WDDayOfWeek.SATURDAY);

which would result in

regards,

christian

Former Member
0 Kudos

Hi Christian,

     Thanks for quick reply...but "firstDayOfWeek" property set to "Auto". At this point how can I write the code?

Thanks and Regards,

Teja

christian_santej
Active Participant
0 Kudos

hi again,

in your view create a new context element (example: name=firstDayOfWeek and the type i've mentioned before com.sap.ide.webdynpro.uielementdefinitions DayOfWeek)

then select the "firstDayOfWeek" attribute in the propertyview. on the left you click on the bind button and select the attribute you've created before (firstDayOfWeek).

so far so good - now in the wdDoInit() method of your view you set the value of this attribute like i described before:


wdContext.currentContextElement().setDayOfWeek(WDDayOfWeek.SATURDAY);

regards,

christian

Former Member
0 Kudos

Hi Christian,

     Thanks for reply.One more thing, this calendar is binded to Inputfield (Context). How can I change days at this point.Do I have to follow same procedure as you mentioned above?

Thanks and Regards,

Teja

christian_santej
Active Participant
0 Kudos

hi Teja,

i'm not sure if i've fully understood your requirement: you try/want to change the starting day of the calendar based on user input? if so - yes - you have to follow the procedure as mentioned above. if the user has selected the starting day you then have to set the value of the binded dayOfWeek attribut accordingly.

regards,

christian

Former Member
0 Kudos

Hi Christian,

     Let me explain you clearly. I have an InputField and calendar is attached to it.


    

Upon Clicking on above field, I am getting a calendar shown as below:


It contains  starting day as Sunday and ending date as Saturday. How can I change the starting date to saturday and ending date as friday.

Thanks and Regards,

Teja.

christian_santej
Active Participant
0 Kudos

Hi Teja,

Based on your feedback you can achieve this by following my previously explained steps (it should always start saturday and end at friday right?)

  • bind an attribute (com.sap.ide.webdynpro.uielementdefinitions DayOfWeek) to the calendar
  • if a date was selected (onAction of the 'Go' button) set the attribute accordingly: wdContext.currentContextElement().setDayOfWeek(WDDayOfWeek.SATURDAY)

regards,

Christian

former_member191044
Active Contributor
0 Kudos

Hello Christian,

i think you still not even got the problem. He uses a input field that was bound to a attribute of type date. So the WD4J run-time provides a datePicker. He can't set any firstDayOfWeek attribute since it is a simple input field.

@Teja: I don't think it is possible what you a trying to do. At least I don't know any param in the WD4J run-time to configure this.

Best Regards,

Tobias

christian_santej
Active Participant
0 Kudos

Hi Tobias,

yup - apparently i didn't got the problem at this point.

after looking again at the provided picture i see that the calendar is a dropdown of mapped input field. thanks for pointing that out.

@Teja: sorry for the misinterpretation. i agree with Tobias on this one. Even if a parameter for this exist it would affect all web dynpro applications on your system (WD4J runtime configuration)

regards,

Christian

Former Member
0 Kudos

Hi Tobias,Christian,

     Thanks for your replies...So conclusion is, it is not possible to change the dayoftheweek in this way....right?

Thanks and Regards,

Teja

former_member191044
Active Contributor
0 Kudos

Yes, unfortunately that's right.

Your welcome,

Tobias

christian_santej
Active Participant
0 Kudos

Hi Teja,

Long story short: no - not as you intend (see answer of Tobias).

I've done some research. The appearance of the calendar (dropdown via date-inputfield) is defined by the locale of the user accessing your application. Example: If your user has the locale en_GB set in its user profile then the firstDayOfWeek is 'Monday' - if it is set to en_US then the firstDayOfWeek is 'Sunday'.

If is/was possible to access the calendar object of the date-inputfield at runtime then it might also be possible to set the firstDayOfWeek parameter...

regards,

Christian

Former Member
0 Kudos

Hi Christian,

    Thanks for the information. You mean, it(date inputfield) depends on browser settings(locale)? or locale is defined at some other place? It seems we don't have calendar object...Is there any way to change the day of week or there is no other way to change it?

Thanks and Regards,

Teja

christian_santej
Active Participant
0 Kudos

Hi Teja,


Thanks for the information. You mean, it(date inputfield) depends on browser settings(locale)? or locale is defined at some other place?

Indirectly - It depends on the configuration of your user/application. please refer to the documentation on: Sequence of Language Display - Developing Java Web Dynpro Applications - SAP Library .

Example:

  • Language of user (handled via identity management of the netweaver system) is set to en_US results in (Start = Sunday):
  • Language of user (handled via identity management of the netweaver system) is set to en_GB results in (Start = Monday):

  • Language of user (handled via identity management of the netweaver system) is set to null/empty. Refering to the documentation i've provided before - the browser language is take (en_AU in my case) which results in (Start = Sunday):

This particular date picker depends on the locale of the user...so as far as i can say it is not possible to set the day of week directly (@ date inputfield) as you intend...

regards,

Christian

Former Member
0 Kudos

Hi Christian,

     Seems It depends on the browser settings. I checked with en_GB, then it displayed with starting date as monday. But I want it to be Saturday. Is there any other code like en_GB which contains first day as saturday and end day as friday?

Thanks and Regards,

Teja.

christian_santej
Active Participant
0 Kudos

hi teja,

it seems that all arabic locales have the firstdayofweek set to saturday:


Arabic (United Arab Emirates):ar_AE: 7 : Saturday

Arabic (Iraq):ar_IQ: 7 : Saturday

Arabic (Yemen):ar_YE: 7 : Saturday

Arabic (Qatar):ar_QA: 7 : Saturday

Arabic (Saudi Arabia):ar_SA: 7 : Saturday

Arabic (Lebanon):ar_LB: 7 : Saturday

Arabic (Kuwait):ar_KW: 7 : Saturday

Arabic (Sudan):ar_SD: 7 : Saturday

Arabic (Syria):ar_SY: 7 : Saturday

Arabic (Bahrain):ar_BH: 7 : Saturday

Arabic (Tunisia):ar_TN: 7 : Saturday

Arabic (Jordan):ar_JO: 7 : Saturday

Arabic (Egypt):ar_EG: 7 : Saturday

Arabic (Morocco):ar_MA: 7 : Saturday

Arabic (Algeria):ar_DZ: 7 : Saturday

Arabic (Libya):ar_LY: 7 : Saturday

Arabic:ar: 7 : Saturday

Arabic (Oman):ar_OM: 7 : Saturday

regards,

christian

Former Member
0 Kudos

Hi Christian,

     Thanks for the information. But when I change the browser language settings to that language(Arabic), whole page is changed to arabic. I think it is not possible to change date input field to saturday.

Thanks and Regards,

Teja.

christian_santej
Active Participant
0 Kudos

yeah that's the drawback and the reason to my opinion that it is not possible to configure the inputfield(date) - calendar as you intend

regards,

christian

Answers (0)