jquery - Populating Kendo Read datasource -
i cannot scheduler populate data being pulled outside function. kendo ui. cant calendar show of appoinments being pulled database. have ideas? thanks
$(function () { $("#scheduler").kendoscheduler({ date: new date("2013/6/13"), starttime: new date("2013/6/13 07:00 am"), height: 600, views: [ "day", { type: "week", selected: true }, "month", "agenda" ], timezone: "etc/utc", datasource: { batch: true, transport: { read: { url: "/team/calendar/populatecalendar/", datatype: "json", }, update: { url: "http://demos.kendoui.com/service/tasks/update", datatype: "jsonp" }, create: { url: "http://demos.kendoui.com/service/tasks/create", datatype: "jsonp" }, destroy: { url: "http://demos.kendoui.com/service/tasks/destroy", datatype: "jsonp" }, parametermap: function (options, operation) { if (operation !== "read" && options.models) { return { models: kendo.stringify(options.models) }; } } }, schema: { model: { id: "taskid", fields: { taskid: { from: "taskid", type: "number" }, title: { from: "title", defaultvalue: "no title", validation: { required: true } }, start: { type: "date", from: "start" }, end: { type: "date", from: "end" }, starttimezone: { from: "starttimezone" }, endtimezone: { from: "endtimezone" }, description: { from: "description" }, recurrenceid: { from: "recurrenceid" }, recurrencerule: { from: "recurrencerule" }, recurrenceexception: { from: "recurrenceexception" }, ownerid: { from: "ownerid", defaultvalue: 1 }, isallday: { type: "boolean", from: "isallday" } } } }, filter: { logic: "or", filters: [ { field: "ownerid", operator: "eq", value: 1 }, { field: "ownerid", operator: "eq", value: 2 } ] } }, resources: [ { field: "ownerid", title: "owner", datasource: [ { text: "alex", value: 1, color: "#f8a398" }, { text: "bob", value: 2, color: "#51a0ed" }, { text: "charlie", value: 3, color: "#56ca85" } ] } ] }); $("#people :checkbox").change(function (e) { var checked = $.map($("#people :checked"), function (checkbox) { return parseint($(checkbox).val()); }); var filter = { logic: "or", filters: $.map(checked, function (value) { return { operator: "eq", field: "ownerid", value: value }; }) }; var scheduler = $("#scheduler").data("kendoscheduler"); scheduler.datasource.filter(filter); }); });
here function pulling data from.
public actionresult populatecalendar() { using (var entities = new openroad.data.repository.openroadentities()) { var appointments = (from e in entities.appointments e.userid == openroad.web.session.userid select new models.calendar { taskid = e.appointmentid, userid = e.userid ?? '1', title = e.subject, description=e.description, start = e.starttimeutc ?? datetime.now, end = e.endtimeutc ?? datetime.now, isallday = false, recurrencerule= null, recurrenceid=null, recurrenceexception=null, starttimezone=null, endtimezone=null, }).orderby(o => o.start).tolist(); return json(appointments, jsonrequestbehavior.allowget); } }
try define properties on server write first small letter ;) step number 2 can remove "schema: { model: {" block becouse fake... :-d
Comments
Post a Comment