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

Kendo Calendar Datasource

8 Answers 215 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
livashini
Top achievements
Rank 1
livashini asked on 12 Sep 2014, 12:27 PM
hi,
how can we bind data to kendo calendar from database?, if this possible please give me any solution....

Here's my code
 var today = new Date();
        var events = new kendo.data.DataSource({
            transport: {
               read: {
                    url: '@Url.Action("GetCalendarDate", "Calendar")',
                    dataType: 'json'
                }
            },
        });

        $("#calendar").kendoCalendar({
            change: onChange,
            value: today,
            dates: events,
            month: {
                
                content: '# if ($.inArray(+data.date, data.dates) != -1) { #' +
                            '<div class="' +
                               '# if (data.value < 10) { #' +
                                   "exhibition" +
                               '# } else if ( data.value< 20 ) { #' +
                                   "party" +
                               '# } else { #' +
                                   "cocktail" +
                               '# } #' +
                            '">#= data.value #</div>' +
                         '# } else { #' +
                         '#= data.value #' +
                         '# } #'
            }
  });
But it doesn't work. please anyone can tel me the write way for that, Please help me.

Thanks.










8 Answers, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 17 Sep 2014, 06:46 AM
Hi Livashini,

The Kendo UI Calendar does not support data binding. As it is a static widget that offers date selection functionality there is not really a point in data bindings. If you want to show events in a Scheduler like widget, I would suggest you to take a look at the following demo:

http://demos.telerik.com/kendo-ui/scheduler/index

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
livashini
Top achievements
Rank 1
answered on 17 Sep 2014, 08:00 AM
thank u very much for your reply
but i done that data binding form database to kendo calendar 

thank you 
0
Kiril Nikolov
Telerik team
answered on 17 Sep 2014, 08:08 AM
Hello Livashini,

The Calendar does not support dataBinding, and there is no documentation or a demo article that shows such functionality. I would still suggest you to consider the Kendo UI Scheduler if you want to show events in a Calendar like widget.

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Anushri
Top achievements
Rank 1
answered on 03 Dec 2015, 08:45 PM

Hi Livashini,

 

Can you share data binding from database to kendo calendar, Please

0
Kiril Nikolov
Telerik team
answered on 04 Dec 2015, 08:19 AM

Hello Anushri,

 

As I said in my previous response - the calendar does not support data binding.

 

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Saima
Top achievements
Rank 1
answered on 04 Feb 2016, 05:46 AM
Can you plz share your code to bind to database?
0
livashini
Top achievements
Rank 1
answered on 04 Feb 2016, 11:47 AM

 I Used ajax for return data from database, after return the data i wrote following function to bind dates to calender

 function GetCal(dataCal) {
        var events = new Array();
        $.holdReady( true );
        for (i = 0; i < dataCal.length; i++) {
            events.push(+new Date(dataCal[i].YY, dataCal[i].MM, dataCal[i].DD));
        }

        $("#calendar").kendoCalendar({
            change: onChange,
            value: today,
            dates: events,
            month: {
                // template for dates in month view
                content: '# if ($.inArray(+data.date, data.dates) != -1) { #' +
                            '<div class="' +
                               '# if (data.value < 10) { #' +
                                   "exhibition" +
                               '# } else if ( data.value < 20 ) { #' +
                                   "party" +
                               '# } else { #' +
                                   "cocktail" +
                               '# } #' +
                            '">#= data.value #</div>' +
                         '# } else { #' +
                         '#= data.value #' +
                         '# } #'
            },
            footer: false
        });
    }

0
Anushri
Top achievements
Rank 1
answered on 04 Feb 2016, 02:00 PM
Thanks for reply but i did that.
Tags
General Discussions
Asked by
livashini
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
livashini
Top achievements
Rank 1
Anushri
Top achievements
Rank 1
Saima
Top achievements
Rank 1
Share this question
or