This is a migrated thread and some comments may be shown as answers.

Datepicker month content with function AngularsJS

2 Answers 63 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
Jhony
Top achievements
Rank 1
Jhony asked on 22 Nov 2016, 08:47 PM

I am creating a datepicker range directive and would like to change the style in the range between the dates it contains in my model, for example between the date model.startDate and model.endDate I want to put a gray background, for this I am using the

month: {

    content: '<div class = \' # = isBetweenDates(data)? "k-state-hover": "" # \ '> # = data.value # </ div>';

}.

My problem is the function .. it only fills my function when I create in the global object .. window.isBetweenDates = function (data) {....

In this case, if I use two directives .. the second will overlap the first one because it will overwrite the method, since it is in the global scope ..

Is there any way I can link that function with each scope  directive that was created, so as not to impact each other? If there is more than one

I tried to make some forms, for example use $ compile and move to content but I can only pass string.

 

Thank You!! 

2 Answers, 1 is accepted

Sort by
0
Jhony
Top achievements
Rank 1
answered on 22 Nov 2016, 08:57 PM

I'm sending you an image to understand better.

In this case it works!!

But if i have more than one datepicker directive, doesn't work! only the last directive created because he overwrite the method.

0
Accepted
Stefan
Telerik team
answered on 24 Nov 2016, 02:19 PM
Hello ,

I can confirm that this is indeed a limitation when using a function in the template of the month.content property of the DatePicker.

In this scenario, I can suggest using different templates with different functions for the DatePicker directives. I understand that this is not the best solution, but in the current implementation of the DatePicker, it is the needed.

Apologies for the inconvenience this may cause you

Regards,
Stefan
Telerik by Progress
Kendo UI is ready for Visual Studio 2017 RC! Learn more.
Tags
Date/Time Pickers
Asked by
Jhony
Top achievements
Rank 1
Answers by
Jhony
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or