<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Appointment Schedular</title> <link href="css/Autovation.css" rel="stylesheet" /> <link href="css/kendo.common.min.css" rel="stylesheet" /> <link href="css/kendo.default.min.css" rel="stylesheet" /> <script src="js/jquery.min.js"></script> <script src="js/kendo.all.min.js"></script></head><script id="editor" type="text/x-kendo-template"> <h3>Edit meeting</h3> <p> <label>Title: <input name="title" /></label> </p> <p> <label>Start: <input data-role="datetimepicker" name="start" /></label> </p> <p> <label>Start: <input data-role="datetimepicker" name="end" /></label> </p></script><?phprequire_once 'dbModules/DataSourceResult.php';require_once 'dbModules/SchedulerDataSourceResult.php';require_once 'Kendo/Autoload.php';if ($_SERVER['REQUEST_METHOD'] == 'POST') { header('Content-Type: application/json'); $request = json_decode(file_get_contents('php://input')); $result = new SchedulerDataSourceResult('mysql:host=localhost;dbname=appdata', 'root', '...'); $type = $_GET['type']; $columns = array('ID', 'EstimateID', 'CustomerID', 'Subject', 'Location', 'Description', 'StartTime', 'EndTime', 'VehicleType','IsAllDay', 'Synchronized'); switch($type) { case 'create': $result = $result->create('Appointments', $columns, $request->models, 'ID'); break; case 'update': $result = $result->update('Appointments', $columns, $request->models, 'ID'); break; case 'destroy': $result = $result->destroy('Appointments', $request->models, 'ID'); break; default: $result = $result->read('Appointments', array('ID'), $request); break; } echo json_encode($result, JSON_NUMERIC_CHECK); exit;}$transport = new \Kendo\Data\DataSourceTransport();$create = new \Kendo\Data\DataSourceTransportCreate();$create->url('scheduler.php?type=create') ->contentType('application/json') ->type('POST');$read = new \Kendo\Data\DataSourceTransportRead();$read->url('scheduler.php?type=read') ->contentType('application/json') ->type('POST');$update = new \Kendo\Data\DataSourceTransportUpdate();$update->url('scheduler.php?type=update') ->contentType('application/json') ->type('POST');$destroy = new \Kendo\Data\DataSourceTransportDestroy();$destroy->url('scheduler.php?type=destroy') ->contentType('application/json') ->type('POST');$transport->create($create) ->read($read) ->update($update) ->destroy($destroy) ->parameterMap('function(data) { return kendo.stringify(data); }');$model = new \Kendo\Data\DataSourceSchemaModel();$IDField = new \Kendo\Data\DataSourceSchemaModelField('ID');$IDField->type('number') ->from('ID') ->nullable(false);$estimateID = new \Kendo\Data\DataSourceSchemaModelField('EstimateID');$estimateID->type('number') ->from('EstimateID') ->defaultValue('No title') ->validation(array('required' => true));$customerID = new \Kendo\Data\DataSourceSchemaModelField('CustomerID');$customerID->type('number') ->from('CustomerID') ->defaultValue('No title') ->validation(array('required' => true));$subjectField = new \Kendo\Data\DataSourceSchemaModelField('Subject');$subjectField->type('string') ->from('Subject');$locationField = new \Kendo\Data\DataSourceSchemaModelField('Location');$locationField->type('string') ->from('Location'); $descriptionField = new \Kendo\Data\DataSourceSchemaModelField('Description');$descriptionField->type('string') ->from('Description');$startField = new \Kendo\Data\DataSourceSchemaModelField('StartTime');$startField->type('datetime') ->from('StartTime');$endField = new \Kendo\Data\DataSourceSchemaModelField('EndTime');$endField->type('datetime') ->from('EndTime');$vehicleTypeField = new \Kendo\Data\DataSourceSchemaModelField('VehicleType');$vehicleTypeField->type('string') ->from('VehicleType');$isAllDayField = new \Kendo\Data\DataSourceSchemaModelField('IsAllDay');$isAllDayField->type('boolean') ->from('IsAllDay');$SynchronizedField = new \Kendo\Data\DataSourceSchemaModelField('Synchronized');$SynchronizedField->type('boolean') ->from('Synchronized');$model->id('ID');$model->addField($IDField);$model->addField($estimateID);$model->addField($customerID);$model->addField($subjectField);$model->addField($locationField);$model->addField($descriptionField);$model->addField($startField);$model->addField($endField);$model->addField($vehicleTypeField);$model->addField($isAllDayField);$model->addField($SynchronizedField);$schema = new \Kendo\Data\DataSourceSchema();$schema->data('data') ->errors('errors') ->model($model);$dataSource = new \Kendo\Data\DataSource();$dataSource->transport($transport) ->schema($schema) ->batch(true);//$editable = new \Kendo\UI\SchedulerEditable();//$confirmation = true;//$editable->confirmation($confirmation);//$editable->template('$editor')//;$scheduler = new \Kendo\UI\Scheduler('scheduler');$scheduler->timezone('America/Toronto') ->date(new DateTime()) ->height('850') ->addView(array('type' => 'day', 'startTime' => new DateTime('7:00',new DateTimeZone('America/Toronto'))), array('type' => 'week', 'selected' => true, 'startTime' => new DateTime('7:00',new DateTimeZone('America/Toronto'))), 'month', 'agenda') ->dataSource($dataSource);?><?phpecho $scheduler->render();?><%@ Page Language="C#" AutoEventWireup="true" CodeBehind="sheduler.aspx.cs" Inherits="WebApplication1.sheduler" %><!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title></title> <link href="../../App_Global/styles/kendo.common.min.css" rel="stylesheet" /> <link href="../../App_Global/styles/kendo.default.min.css" rel="stylesheet" /> <script src="../../App_Global/js/jquery.min.js"></script> <script src="../../App_Global/js/kendo.all.min.js"></script> <script src="App_Global/js/kendo.web.min.js"></script> </head><body> <div></div> <div id="example" class="k-content"> <div id="scheduler"></div></div><script> var url = 'Service1.svc/'; var dataal; var dataSource1 = new kendo.data.SchedulerDataSource({ batch: true, data:dataal, transport: { read: function (options) { $.ajax({ url: url + "getsheduler", dataType: "json", async: false, cache:false, success: function (result) { options.success(JSON.parse(result.d)); }, error: function (result) { alert("error"); } }); } }, schema: { model: { id: "taskId", fields: { taskId: { from: "taskid", type: "number" }, title: { from: "taskname", defaultValue: "No title", validation: { required: true } }, start: { type: "date", from: "credate" }, end: { type: "date", from: "duedate" }, startTimezone: { from: "StartTimezone" }, endTimezone: { from: "EndTimezone" }, description: { from: "Description" }, recurrenceId: { from: "RecurrenceID" }, recurrenceRule: { from: "RecurrenceRule" }, recurrenceException: { from: "RecurrenceException" }, ownerId: { from: "projectid", defaultValue: 1 }, isAllDay: { type: "boolean", from: "IsAllDay" } } } } });
$(document).ready(function () { $("#scheduler").kendoScheduler({ date: new Date("2013/9/13"), startTime: new Date("2013/9/13 07:00 AM"), selectable: true, height: 600, views: [ "day", "week", { type: "month", selected: true }, ], timezone: "Etc/UTC", dataSource: dataSource1 }); });</script></body></html>using System;using System.Collections.Generic;using System.Linq;using System.Runtime.Serialization;using System.ServiceModel;using System.ServiceModel.Activation;using System.ServiceModel.Web;using System.Text;using Newtonsoft.Json;using System.Data.SqlClient;using System.Data;namespace WebApplication1{ [ServiceContract(Namespace = "")] [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] public class Service1 { String strConnString = "database=sample; server=URCI74;uid=sa;password=local"; [OperationContract] public void DoWork() { // Add your operation implementation here return; } // Add more operations here and mark them with [OperationContract] [OperationContract] [WebGet] public object getsheduler() { SqlConnection con = new SqlConnection(strConnString); SqlDataAdapter adpt = new SqlDataAdapter(); DataSet ds = new DataSet(); adpt = new SqlDataAdapter("select projectid as ownerId, taskname as title ,credate as start,duedate [end],startTimezone,endTimezone,description,recurrenceId,recurrenceRule,recurrenceException,isAllDay from sheduler
", con); adpt.Fill(ds); return JsonConvert.SerializeObject(ds.Tables[0]); } }}

public JsonResult Aspect(string term){ // ...}$(".autocomplete").kendoAutoComplete({ dataTextField: "Name", dataSource: { type: "json", transport: { read: "/search/aspect", data: { term: $(this).val() } } }});Hi,
I've set up a Kendo Grid, and am customising the filter interface to show all values in a DropDownList. Through the DropDownList DataSource object I'm grouping on the field to be displayed (thereby removing any duplicates).
This works fine and shows exactly those values which should show, however on selecting a value I get an error in the kendo.all.js change function at the following line:
sourceValue = sourceItem.get(field);
The error being "Object doesn't support property or method 'get'"
Is this a bug in Kendo, or am I doing something wrong?!
For reference, the DropDownList is set up using the following code which is called from the filter UI function for each individual column (this applies to several columns). The filter function is there to filter the values based on all filters applied to the grid (i.e. so each filter only shows those values which are currently present in the grid according to applied filters):
function setFilter(url, element, field) { element.kendoDropDownList({ dataSource: { transport: { read: { url: url, data: { filter: function() { var filters = $("#AccountsGrid").data("kendoGrid").dataSource.filter(); var result = {}; if (filters) { result.logic = filters.logic; var filterArray = new Array(); for (var i = 0; i < filters.filters.length; i++) { filterArray.push({ operator: filters.filters[i].operator, field: filters.filters[i].field, value: filters.filters[i].value }); } result.filters = filterArray; } return JSON.stringify(result); } } } }, group: { field: field }, serverFiltering: true }, dataValueField: "value", dataTextField: "value", optionLabel: "--Select Value--" });}