Updating a single event from server

Hi,

I would like to be able to update information on a particular event if this is changed on the server side without reloading all the client side events.

My current code to load in the events is

    public ContentResult Data()
    {
        HttpApplicationState application = HttpContext.ApplicationInstance.Application;
        List<Jobiteration> iterationlist = GetSchedulerJobIterations();
        var data = new SchedulerAjaxData(iterationlist);
        return Content(data.Render(eventRenderer));
    }

    private void eventRenderer(System.Text.StringBuilder builder, object ev)
    {
        CreateSchedulerData(builder, ev);
    }

    private System.Text.StringBuilder CreateSchedulerData(System.Text.StringBuilder builder, object ev)
    {
        var item = ev as Jobiteration;
        try
        {
            DateTime endtime = Convert.ToDateTime(item.Scheduleddt).AddMinutes(Convert.ToInt16(item.Duration));
            builder.Append(
                    string.Format("{{id:{0}, text:\"{1}\", start_date:\"{2:MM/dd/yyyy HH:mm}\", end_date:\"{3:MM/dd/yyyy HH:mm}\", assignedto:\"{4}\"}}",
                    item.Jobnumber,
                    HttpUtility.JavaScriptStringEncode(item.Description),
                    item.Scheduleddt,
                    endtime,
                    item.Assignedto
                    ));
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.ToString());
        }
        return builder;
    }

What type of method would i call to update the start and end date for id 12345?

Thanks for your help

Hello,
check this article
scheduler-net.com/docs/managing_ … the_server

Hi,

Already seen the article. Didn’t find it very helpful.

public ContentResult Save(int? id, FormCollection actionValues)
{

var response = new AjaxSaveResponse(action);
response.UpdateField(“propertyName”, propertyValue);

return (ContentResult)response;
}

I can’t see a reference to the id anywhere, if i called
Save(12345, formActionValues);

would this edit item 12345?

Hello,
I’m not sure i following.
“public ContentResult Save” should not be called directly, it is controller’s action that process http reqest from the client side
The way with “response.UpdateField” designed for the cases when event could be modified during the save operation, and that changes must be sent back to the client.

I would like to be able to update information on a particular event if this is changed on the server side without reloading all the client side events.
Did you mean that changes are made outside the scheduler, and you need to update scheduler data appropriately?
If so, you may try ‘live update’ mode, you can send updates to the client with signalR async library
scheduler-net.com/docs/live_update.html

Live update mode is definitely the option I require. However, I am getting this error
DHTMLX.Scheduler.SchedulerExtensions.Extension’ does not contain a definition for ‘LiveUpdates’

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using DHTMLX.Scheduler;
using DHTMLX.Common;
using DHTMLX.Helpers;
using DHTMLX.Scheduler.Settings;
using DHTMLX.Scheduler.Data;
using DHTMLX.Scheduler.Controls;
using JobClassLib;
using Connect.Server;
using JobClassLib.ConnectJobClasses;
using Ninject;
using ConnectContext;

I have these assemblies loaded. Am I missing anything?

Extension was released at the end of November 2012, in v2.1 of dhtmlxScheduler for .Net
blog.scheduler-net.com/post/2012 … ments.aspx
what version of the component do you use?

Hi,

Thanks for your help so far.

    hub.client.addMessage = function (message) {
        var parsedMessage = JSON.parse(message);
        scheduler.dataProcessor.applyChanges(parsedMessage);
    };

I have this method and the following object
{ “id”: “272431346”, “text”: “272431346 FISHERS LANE¬REGENCY 2060/BLOCK 1:GROUND FLOOR STAIRWELL LIGHT¬A”, “start_date”: “04/15/2013 11:00”, “end_date”: “04/15/2013 15:00”, “assignedto”: “awakeham” }

here are the scheduler setup options in c#

        var scheduler = new DHXScheduler(this);
        scheduler.Extensions.Add(SchedulerExtensions.Extension.LiveUpdates);
        scheduler.EnableDataprocessor = true;
        scheduler.Skin = DHXScheduler.Skins.Glossy;
        scheduler.InitialDate = DateTime.Now;
        scheduler.LoadData = true;
        scheduler.Config.first_hour = 8;
        scheduler.Config.last_hour = 18;
        scheduler.Data.DataProcessor.UpdateFieldsAfterSave = true;

So I am passing the JSON object to applyChanges and nothing happens to the scheduler.

Please help

I have version 2.1 by the way

Can you check browser console, are there any error messages?