We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Set startLevel and depthLevel

Good morning,

I need to set startLevel and depthLevel to ej.DatePicker.Level.Year in order to have a year picker.

Sample code:

var $input = $('input');
$input.ejDatePicker({width: $input.width()});
$input.ejDatePicker('option', 'locale', 'it-IT')
           .ejDatePicker('option', 'dateFormat', 'yyyy')
           .ejDatePicker('option', 'startLevel', ej.DatePicker.Level.Year)
           .ejDatePicker('option', 'depthLevel', ej.DatePicker.Level.Year)

By setting these options the effect is that the datepicker is opened as a normal datepicker, but after a click on the change month arrow is refreshed correctly.

Datepicker

5 Replies

MM Manikandan Mariappan Syncfusion Team January 9, 2015 12:18 PM UTC

Hi Irvin Dominin,

Thank you for your interest in Syncfusion Products.

Query 1: Depth level and start level as YEAR, the datepicker popup is opened as a date view not a year view after a click on the change month arrow is refreshed correctly

Sorry about inconvenience caused.

We have tested the reported issue in our latest 12.4 version and the issue is not reproduced at our end. We have prepared a simple sample to showcase this, please find the sample from the following location:

Sample Location: Sample

The above attached sample is created by using the latest source, could you please check the given sample? If still the problem persists, please revert us by modifying the sample based on your application along with the replication procedure. This would be helpful for us to serve you better.

Please let us know if you need any further assistance,

Regards,

Manikandan Mariappan



ID Irvin Dominin replied to Manikandan Mariappan January 9, 2015 01:45 PM UTC

Hi Irvin Dominin,

Thank you for your interest in Syncfusion Products.

Query 1: Depth level and start level as YEAR, the datepicker popup is opened as a date view not a year view after a click on the change month arrow is refreshed correctly

Sorry about inconvenience caused.

We have tested the reported issue in our latest 12.4 version and the issue is not reproduced at our end. We have prepared a simple sample to showcase this, please find the sample from the following location:

Sample Location: Sample

The above attached sample is created by using the latest source, could you please check the given sample? If still the problem persists, please revert us by modifying the sample based on your application along with the replication procedure. This would be helpful for us to serve you better.

Please let us know if you need any further assistance,

Regards,

Manikandan Mariappan


Hi Manikandan,

I noticed now that the issue is caused by setting the value option; like:
            var date = new Date();
            $input.ejDatePicker('option', 'value', date);

after this code I face the issue.

In the attachment there is your example modified.

Kind regards,
Irvin Dominin  


MM Manikandan Mariappan Syncfusion Team January 12, 2015 07:12 AM UTC

Hi Irvin Dominin,

Sorry about inconvenience caused,

We have also checked the reported issue “value set dynamically by using the option method” but still we couldn’t reproduce the reported issue in our end.

    <script type="text/javascript">

        $(function () {

            // declaration

            var $input = $('input');

            var date = new Date();

            //control rendering

            $input.ejDatePicker({ width: $input.width() });

            //set the value using the option method

            $input.ejDatePicker('option', 'value', date)

                       .ejDatePicker('option', 'locale', 'it-IT')

                       .ejDatePicker('option', 'dateFormat', 'yyyy')

                       .ejDatePicker('option', 'startLevel', ej.DatePicker.Level.Year)

                       .ejDatePicker('option', 'depthLevel', ej.DatePicker.Level.Year)

        });

    </script>

We have prepared a sample with above code blocks to showcase this, please find the sample from the following location.

Location:  Sample

In the above sample, we have used the latest source and option method to set the value dynamically. Please let us know the version that you are using in your application? Also, please check the sample, if the issue still persists, then revert us by modifying the sample based on your application along with the replication procedure. That would be helpful for us to serve you better.

Please let us know if you need any further assistance,

Regards,

Manikandan Mariappan




ID Irvin Dominin replied to Manikandan Mariappan January 12, 2015 07:41 AM UTC

Hi Irvin Dominin,

Sorry about inconvenience caused,

We have also checked the reported issue “value set dynamically by using the option method” but still we couldn’t reproduce the reported issue in our end.

    <script type="text/javascript">

        $(function () {

            // declaration

            var $input = $('input');

            var date = new Date();

            //control rendering

            $input.ejDatePicker({ width: $input.width() });

            //set the value using the option method

            $input.ejDatePicker('option', 'value', date)

                       .ejDatePicker('option', 'locale', 'it-IT')

                       .ejDatePicker('option', 'dateFormat', 'yyyy')

                       .ejDatePicker('option', 'startLevel', ej.DatePicker.Level.Year)

                       .ejDatePicker('option', 'depthLevel', ej.DatePicker.Level.Year)

        });

    </script>

We have prepared a sample with above code blocks to showcase this, please find the sample from the following location.

Location:  Sample

In the above sample, we have used the latest source and option method to set the value dynamically. Please let us know the version that you are using in your application? Also, please check the sample, if the issue still persists, then revert us by modifying the sample based on your application along with the replication procedure. That would be helpful for us to serve you better.

Please let us know if you need any further assistance,

Regards,

Manikandan Mariappan




Hi Manikandan Mariappan,

fo face the issue the value must be set after the initialization of the displaying options like:
            // declaration
    var $input = $('input');
            $input.ejDatePicker({ width: $input.width() });
$input.ejDatePicker('option', 'locale', 'it-IT')
                   .ejDatePicker('option', 'dateFormat', 'yyyy')
                   .ejDatePicker('option', 'startLevel', ej.DatePicker.Level.Year)
                   .ejDatePicker('option', 'depthLevel', ej.DatePicker.Level.Year)
     // value set
     var date = new Date();      
    $input.ejDatePicker('option', 'value', date)

Kind regards,
Irvin Dominin


MM Manikandan Mariappan Syncfusion Team January 13, 2015 09:13 AM UTC

Hi Irvin Dominin,

Sorry for the inconvenience caused. We are able to reproduce the specified issue from your update. We have confirmed that the issue with (“depth level and start level as YEAR, the datepicker popup is opened as a date view not a year view after a click on the change month arrow is refreshed correctly”) is a defect and we have logged a defect report and the fix will be included in our upcoming service pack, which has been scheduled to be rolled out at end of January 2015.

Please let us know if you need any further assistance,

Regards,

Manikandan Mariappan



Loader.
Up arrow icon