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

scheduler and json

1 Answer 108 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Jorge David
Top achievements
Rank 1
Jorge David asked on 20 May 2016, 05:18 PM

Hello I'm David. I have a problem with scheduler. I have a web service json with the following information.

[{"id":"1","start":"2016\/05\/20 08:00 AM","end":"2016\/05\/20 08:00 AM","isAllDay":true,"title":"PRUEBA DIGITALIZACION","description":"C000001"},{"id":"2","start":"2016\/05\/20 08:00 AM","end":"2016\/05\/20 08:00 AM","isAllDay":true,"title":"uno","description":"C000002"},{"id":"3","start":"2016\/05\/20 08:00 AM","end":"2016\/05\/20 08:00 AM","isAllDay":true,"title":"uno","description":"C000003"}]

and do not know how to put it into my schedule scheduler on the corresponding dates . Deputy code if anyone can help me please.

 

// agenda.php
<html>
    <head>
        <meta charset="utf-8">
        <link href="../../system/telerik/content/shared/styles/examples-offline.css" rel="stylesheet" type="text/css"/>
        <link href="../../system/telerik/styles/kendo.common.min.css" rel="stylesheet" type="text/css"/>
        <link href="../../system/telerik/styles/kendo.rtl.min.css" rel="stylesheet" type="text/css"/>
        <link href="../../system/telerik/styles/kendo.default.min.css" rel="stylesheet" type="text/css"/>
        <link href="../../system/telerik/styles/kendo.dataviz.min.css" rel="stylesheet" type="text/css"/>
        <link href="../../system/telerik/styles/kendo.dataviz.default.min.css" rel="stylesheet" type="text/css"/>


        <script src="../../system/telerik/js/jquery.min.js" type="text/javascript"></script>
        <script src="../../system/telerik/js/jszip.min.js" type="text/javascript"></script>
        <script src="../../system/telerik/js/kendo.all.min.js" type="text/javascript"></script>
        <script src="../../system/telerik/content/shared/js/console.js" type="text/javascript"></script>
        <script>

        </script>
    </head>
    <body>
        <div id="example" class="k-content">

            <!--[if gte IE 9]>-->
            <div id="team-schedule">
                <div id="people">
                    <input checked type="checkbox" id="alex" value="1">
                    <input checked type="checkbox" id="bob" value="2">
                    <input type="checkbox" id="charlie" value="3">
                </div>
            </div>
            <div id="scheduler"></div>
            <script src="../../system/telerik/content/shared/js/everlive.all.js"  type="text/javascript"></script>
            <script>
                    // initialize Backend Services (Everlive) application with application API key
                    var dataSource = new kendo.data.SchedulerDataSource({
                    transport: {
                    read: {                   
                    url: "service.php",// my web service
                            dataType: "jsonp"
                    }  }      });
              $("#scheduler").kendoScheduler({
            date: new Date("2016/05/20"),
                    views: ["day", "month"],
                    dataSource: [
                        { id: 1,
                            start: new Date("2016/05/20 08:00 AM"),
                            end: new Date("2016/05/20 09:00 AM"),
                            isAllDay: true,
                            title: "hola jorge",
                            description: "lo que sea"
                    } ],
                    edit: function (e) {
                    console.log("Editing", e.event.title);
                    }
            });
            </script>

        </div>

        <style>
            .k-nav-current > .k-link span + span {
                max-width: 200px;
                display: inline-block;
                white-space: nowrap;
                text-overflow: ellipsis;
                overflow: hidden;
                vertical-align: top;
            }

            #team-schedule {
                background: url('../../system/telerik/content/web/scheduler/team-schedule.png') transparent no-repeat;
                height: 115px;
                position: relative;
            }

            #people {
                background: url('../../system/telerik/content/web/scheduler/scheduler-people.png') no-repeat;
                width: 345px;
                height: 115px;
                position: absolute;
                right: 0;
            }

            #alex {
                position: absolute;
                left: 4px;
                top: 81px;
            }
            #bob {
                position: absolute;
                left: 119px;
                top: 81px;
            }
            #charlie {
                position: absolute;
                left: 234px;
                top: 81px;
            }
        </style>
    </body>
</html>
// end agenda.php

 

 

 

 

 

//start service.php

<?php
include("clase_principal.php");
$frame = new frames();
$query = "SELECT doc_documentos_id,fecha_creacion,fecha_creacion, "
        . "titulo,codigo_documento FROM "
        . "doc_documentos limit 3";
$matriz_documentos = $db_obj->ejecutar_consulta($query);
foreach ($matriz_documentos as $registro) {
    $tmpMatriz = Array(
        "id" => $registro[0],
        "start" => "2016-05-20 09:00:00",
        "end" =>"2016-05-20 09:00:00",
        "isAllDay" => true,
        "title" => $registro[3],
        "description" => $registro[4]
    );
    $retorno[] = $tmpMatriz;
}
$Json_telerik = json_encode($retorno);
echo $Json_telerik;
 

 

 

1 Answer, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 24 May 2016, 12:05 PM
Hello Jorge,

First I would suggest to use better date format with zone designator set to UTC (like ISO8601) as described in the following help article:

I also tested the code that you provide on our side and it's working as expected - could you please check it and let me know how it differs from your real setup?

Regards,
Vladimir Iliev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Scheduler
Asked by
Jorge David
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Share this question
or