Unplanned
Last Updated: 13 May 2019 08:44 by ADMIN
Charline
Created on: 09 May 2019 14:05
Category: Date/Time Pickers
Type: Feature Request
7
Kendo UI DatePicker dateInput should be able to set messages

Dear support,

 

I didn't find in your documentation if and how we can use data-* annotations to setup dataInput options of a datepicker.

I would like to do the same thing that the code below does but with MVVM data-* annotation.

            self.date= $('#dateExample').kendoDatePicker({
                format: 'dd.MM.yyyy',
                dateInput: true,
            }).data('kendoDatePicker');
            self.date._dateInput.setOptions({
                format: 'dd.MM.yyyy',
                messages: {
                    'year': 'yyyy',
                    'month': 'mm',
                    'day': 'dd'
                }

I globally use data-bind for html and kendo UI components. 

I just added the data-format in my html like below, and it works.

  <input data-role="datepicker" id="dateExample" data-format="dd.MM.yyyy" data-bind="value: myValue">

I wonder if we can setup format and messages options for the dateinput of the datepicker with MVVM without using jquery (with something like data-dateinput, data-dateinput-format, data-dateinput-messages...).

 

Thanks in advance for your usual support.

Regards,

Charline.

        
3 comments
ADMIN
Alex Hajigeorgieva
Posted on: 13 May 2019 08:44
Hello, Charline,

I have transformed this to a public item and it is now available for voting at:

https://feedback.telerik.com/kendo-jquery-ui/1408324-kendo-ui-datepicker-set-dateinput-options-with-attributes-mvvm

Kind Regards,
Alex Hajigeorgieva
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Charline
Posted on: 10 May 2019 16:48

Dear Alex,

 

Thanks for your reply.

It was what I thought. I tried a lot of options with capital or dash/lower but it was not working as expected. It was the reason I decided to contact you.

As you replied that this is not supported, I handed it today with jquery code.

 var datePickers = $("input[data-role='datepicker']");

            datePickers.each((index, datePicker) => {
                var kendoDatePicker = $(datePicker).kendoDatePicker({
                    format: 'dd.MM.yyyy',
                    dateInput: true,
                    parseFormats : ['dd.MM.yyyy','yyyy-MM-dd']
                }).data('kendoDatePicker');
                if (kendoDatePicker) {
                    kendoDatePicker._dateInput.setOptions({
                        format: 'dd.MM.yyyy',
                        messages: {
                            'year': 'yyyy',
                            'month': 'mm',
                            'day': 'dd'
                        }
                    });
                }
            });

 

For me this feature is a must-have for a full MVVM use, so yes, please kindly add it in the Feature Request list. 

 

Thank you & Regards,

Charline.

ADMIN
Alex Hajigeorgieva
Posted on: 10 May 2019 15:37
Hello, Charline,

Please accept my apology for the delay in getting back to you.

To add the dateInput configuration to the Kendo UI DatePicker initialized with the MVVM approach use the following convention - when the property is camel case, where the capital letter is, break it with a dash and make it lowercase:

https://docs.telerik.com/kendo-ui/intro/widget-basics/data-attribute-initialization#set-data--options

data-date-input="true"

You suggestion to be able to configure the dateInput widget absolutely makes sense, however at the moment that configuration setting accepts only booleans and any messages that you may be able to set, will be lost. When such setting is enabled, it is done with an object:

data-date-input="{ messages: { month: 'mymonth'} }"

Would you like me to log this as a Feature Request on your behalf so people can upvote it? I think it would make a wonderful addition to the existing functionality?

Look forward to hearing back from you.

Kind Regards,
Alex Hajigeorgieva
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.