Custom Lightbox removes inserted events

I’m have a lot of trouble with this example when it comes to inserting a new event.

scheduler-net.com/docs/lightbox.html

Whenever the POST is sent to the page, I am able to persist the event but the SchedulerFormResponseScript result I don’t think is sending back exactly what the calendar needs as after you hit save in the Lightbox the event disappears from the calendar.

Here is what is being sent back to the browser:

Code:

return new SchedulerFormResponseScript(action, new { event.id, event.start_date, event.end_date, event.text });

Response:

I’ve tried sending back a lot of different content results such as AjaxSaveResponse and ContentResult, but I just can’t get this to work via custom Lightbox. Is there a downloadable example that uses SchedulerFormResponseScript so I can review what the response should look like? I am guessing it is in the “data” portion of the script that is off as the above example doesn’t detail what the Event object looks like…

Any help would be appreciated.

Hi,
you can find an example in one of MVC sample projects (Scheduler.MVC3, Scheduler.MVC3.VB or Scheduler.MVC5)
On the index page it’s called ‘.Net form in lightbox’ and the controller is called MVCFormInLightbox

Aliaksandr,

Thanks for the quick reply - your answer lead me exactly to what I was looking for…

Unfortunately, your demo has the same bug that I am seeing which is narrowed down to…

Bug:

SchedulerFormResponseScript responses from Custom Lightbox implementations does not save new events when in TIMELINE View.

Scenario:

  1. Run MVCFormInLightboxController example
  2. Click the Timeline view
  3. Attempt to add an event
  4. Notice UI drops the event

Environment:

DHTMLX.Scheduler.NET.3.31.0
MVC5
VS2013
FF / IE

Let me know if I can be of any assistance - I am happy to clear up this bug as quickly as possible.

Hi,
i think got it.
The issue is not in a lightbox response. The sample seems to be incomplete - the form does not send a ‘room_id’ property, which defines a section of the lightbox event is assigned to.

So after saving it’s assigned to none of them and dissapears.

In MVC5 sample, try addign a following input to the form (LightboxControl.cshtml)

@Html.HiddenFor(m => m.room_id)

Thanks for the direction, I finally got it working by comparing the sample with my implementation.

For prosperity, here it ultimately what your object must (at minimum, it can have extra fields) that needs to serialized as the data object in the SchedulerFormResponseScript

  • id (Int32)
  • text (string)
  • start_date (datetime as string)
  • end_date (datetime as string)
  • y_property (the property name you passed into the TimelineView ctor)

My particular problem was that I was not passing the y_property and the id was an Int64.

Thanks for the quick help!