3

I downloaded Kendo UI Core, then included the kendo.ui.core.min.js and kendo.bootstrap.min.css files. Added the bundles etc.. So I was trying to create a datepicker doing this

<input class='k-widget k-calendar' id='StartingDate'></input>

<script type="text/javascript"> 
  $(function () {
      $('#StartingDate').kendoDatePicker();
  })
</script> 

but it is not working. The method kendoDatePicker() doesn't exist. I looked through the JS and it looked they were using DateView, but that didn't work either. Is there a different method, or am I missing something to make this work?

Krisztián Balla
  • 19,223
  • 13
  • 68
  • 84
DeadlyChambers
  • 5,217
  • 4
  • 44
  • 61

1 Answers1

3

You need to make sure you include jQuery before kendo.ui.core (so Kendo UI can set up the widgets in $.kendoWidgetName) and that you're only including jQuery once (so the $ variable Kendo UI set itself up in isn't overwritten).

Lars Höppner
  • 18,252
  • 2
  • 45
  • 73
  • 1
    Thanks Lars, do you know why the default template would include jquery twice? – DeadlyChambers Apr 19 '14 at 21:17
  • I think you may have included it yourself when you added the Kendo UI files, and the other one is created via something like this @Scripts.Render("~/bundles/jquery") at the end of the _Layout file – Lars Höppner Apr 19 '14 at 21:23
  • 1
    It's possible. Thanks again for the help. – DeadlyChambers Apr 19 '14 at 21:37
  • I have exactly the same setup and had the same problem. But doing all these steps I still get the following JavaScript error message: kendoDatePicker is not a function. Any ideas? – Krisztián Balla May 05 '14 at 10:25
  • 2
    Ok, I found the problem. I accidentally included kendo.core.min.js instead of kendo.ui.core.min.js – Krisztián Balla May 05 '14 at 10:34
  • @JennyO'Reilly you could probably do without the class on the input. I believe the kendo.ui.core will add the classes. – DeadlyChambers May 05 '14 at 18:10
  • Yes, I can confirm that the classes can be omitted. – Krisztián Balla May 06 '14 at 05:55
  • @Jenny Yeah, it's a bit unfortunate that Telerik chose to call their OSS version "Core" which is the source of this confusion. kendo.core.min.js contains reusable code that is not ui-specific (used in both OSS and professional), while kendo.ui.core contains all of the code for the OSS version, including kendo.core.min.js (I think). – Lars Höppner May 06 '14 at 10:58