Reload Data After Save

Having trouble reloading data after a save. The save is for a custom lightbox, so i have a Save, CustomFormSave and a NativeSave.

I have tried:

function init()
	{
		scheduler.attachEvent("onEventChanged", function ()
		{
			setTimeout(function ()
			{
				scheduler.clearAll();
				scheduler.load('@Url.Action("Experience_Data","Calendar",new{ id = ViewBag.ExperienceId})');
			}, 1);
		})
	}

I get a javascript error though.

Microsoft JScript runtime error: Unable to get value of the property '!nativeeditor_status': object is null or undefined

I tried setting EnableDataprocessor to false in the controller. I don’t get a javascript error and the grid clears and reloads, but it never calls save.

scheduler.EnableDataprocessor = false;

The Save effects multiple events, or else i would try the UpdateFieldsAfterSave.

Any ideas? Thanks for the help.

Hi,
try using onAfterUpdate event of the data processor(EnableDataprocessor should be set true in configuration)function init() { scheduler.dataProcessor.attachEvent("onAfterUpdate", function () { setTimeout(function () { scheduler.clearAll(); scheduler.load('@Url.Action("Experience_Data","Calendar",new{ id = ViewBag.ExperienceId})'); }, 1); }) }

Sorry if i’m missing something simple, but i still get a javascript error.

Microsoft JScript runtime error: Unable to get value of the property 'attachEvent': object is null or undefined

Is this using web sockets? If so, that would explain it. From the requirements here: http://scheduler-net.com/docs/live_update.html

If not, this is what i have:

public ActionResult ScheduleActivities(long id)
{
			ViewBag.ExperienceId = id;

			var scheduler = new DHXScheduler();
			scheduler.LoadData = true;
			scheduler.EnableDataprocessor = true;
			scheduler.BeforeInit.Add("init()");
			scheduler.PreventCache();

			scheduler.Skin = DHXScheduler.Skins.Terrace;
			scheduler.InitialDate = new DateTime(2012, 11, 20);

			string path = Url.Action("ActivityLightBox", "Calendar", new { area = "Admin", id = id });
			path = path.Remove(0, 1);
			var box = scheduler.Lightbox.SetExternalLightbox(path, 600, 500);
			
			scheduler.DataAction = Url.Action("Activities_Data", "Calendar", new { id = id, area = "Admin" }, "http");
			scheduler.SaveAction = Url.Action("Activities_Save", "Calendar", new { area = "Admin" }, "http");

       return View(scheduler);
}
function init()
	{
		scheduler.dataProcessor.attachEvent("onAfterUpdate", function ()
		{
			setTimeout(function ()
			{
				scheduler.clearAll();
				scheduler.load('@Url.Action("Activities_Data","Calendar",new{ id = ViewBag.ExperienceId})');
			}, 1);
		})
	}

Thoughts? Thanks again.

I put this at the bottom of the view(after Model.Render() )

<script type="text/javascript"> dp.attachEvent("onAfterUpdate", function () { setTimeout(function () { scheduler.clearAll(); scheduler.load('@Url.Action("Activities_Data","Calendar",new{ id = ViewBag.ExperienceId})'); }, 1); }) </script>

It seems to work. Do you think this is an ok solution? or is there a better way?

Thanks.

It must not cause any side effects.
The code need to be placed after placing schedulers code on the page, and bottom of the view is the good place for it.