Friday, August 24, 2018

Persian Datepicker for Oracle APEX



This Blog tells us about the Persian Datepicker in Oracle APEX.
We have some issues when we want to have native Persian datepicker:

  • Default Datepicker is Gregorian
  • Old jQuery Versions Desupported(1.7.1)  APEX 18+
  • Gregorian Datepicker to Persian Datepicker
  • Persian Datepicker with Interactive Grid(IG)
AS you know the default datepicker is Gregorian and Jalali Date isn't match with that date so first of all we have to revise it. Next, the old jQuery vesrion desupported of APEX 18+, before that have rewritten with jQuery UI 1.7 and in new version of APEX is not work correctly.

A major issue is when we want to use the datepicker item with Interactive Grid at a same page, because conflict occurs.

Finally, These issues were solved and you should follow below instruction if you would like to use the Persian Datepicker in Oracle APEX. In addition, I have tested on APEX 5.1,18

Demo is available APEXPersianDatepicker

Demo on YouTubeWebinar-APEXPersianDatepicker

Adding JS Files

To upload js files via APEXPersianDatepicker



Call js files according the image




Set NLS DATE

You need to change NLS_CALENDAR , NLS_DATE_FORMAT  [Application / Edit Security Attributes(Database Session)]



BEGIN
   EXECUTE immediate 'ALTER SESSION SET NLS_CALENDAR=PERSIAN';
   EXECUTE immediate 'ALTER SESSION SET NLS_DATE_FORMAT=''YYYY/MM/DD''';
END;
Call Persian Datepicker

You should make a copy from [standard] template and create a new template for example "standard-fix-date" because we must add some codes to "Execute when Page Loads" part.



$(window).load(function () {
    apexrad.util.loadjscssFile("#APP_IMAGES#apexrad-datepicker-fa.min.js", "js")
});


Tips : Application Primary Language must be [Farsi(fa)]


Now, run your application and see Jalali date via Item datepicker.


Enjoy it!







2 comments :

  1. Great And valuable Post, Hope see more post of you soon.
    Thanks

    ReplyDelete
  2. Today button does not work.
    It does not select date of today.
    Thenks

    ReplyDelete