Hi Aliaksandr,
The razor version is working great, the only problem I am having with it - every time I logoff, it gives this weird error
Microsoft JScript runtime error: Unable to set value of the property ‘value’: object is null or undefined
on the line 34 in LogOn: document.getElementById(“UserName”).value = value;
Is there a way to avoid it please?
Thanks
Hello,
go to LogOn.cshtml and remove this line(line:19)
updateCredentials("test");
it should fix the problem
Hello Aliaksandr,
I am testing this solution for scaling: I inserted about 500K events into events table spanning between years 1900 and 2100 (half for “user”, half for “test”). This is normal situation to have large number of events in the calendar if I work with large number of users.
Upon retrieving them, I get the following error in HomeController line 65 ( return new SchedulerAjaxData(events)):
Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.
My question to you is this: how can I limit events I need to retrieve only to the range the scheduler is showing (whether month/week/day view), and not retrieve the entire calendar for the user?
This will not only allow me to retrieve it properly, but also will allow the retrieval be so much faster.
Thanks in advance!
Hi,
you can set a mode for data loading
DHXScheduler.Data.Loader.EnableDynamicLoading(SchedulerDataLoader.DynamicalLoadingMode mode);
available options are ‘month’, ‘day’, ‘year’.
In this case client-side scheduler will send requests as
someurl?from=Date1&to=Date2
where Date1 and Date2 are date values in yyyy-mm-dd format, you can use these values to filter events before render them
Aliaksandr,
Thank you very much for your irreproachable support. I got it working for numerous events pretty fast now. I will ask more should I have questions, it seems that your DHTMLX Scheduler will be my control of choice, but its too early to say, I am still experimenting.
Thanks again! Great support worth even more than the product itself!
Hello again,
Another question:
I was using your razor example (which is great by the way) and following this tutorial http://scheduler-net.com/docs/recurring_events.html for making events recurrable.
Then I wanted to add LightboxMiniCalendar to scheduler.
What I found out is that once default set of Lightbox controls is added (and nothing else) recurring events work fine. But as soon as I add LightboxMiniCalendar (or change Lightbox in any way that is different from standard defaults), recurring effect vaporizes as if it is not defined at all.
My question is - how do I replace LightboxTime with LightboxMiniCalendar and at the same time have recurring events working.
Thank you very much in advance.
Hello,
you need to add LightboxRecurringBlock to your lightbox. This control is added to the default lightbox when you enable recurring extension, in case of any customization you have to add it manually,
code:sched.Lightbox.Add(new LightboxMiniCalendar("auto", "Time"));
sched.Lightbox.Add(new LightboxRecurringBlock("rec_type", "Recurring"));
note control should be mapped to ‘rec_type’ property
Thanks you ! That worked.
Another question:
I getting completely weird “A circular reference was detected while serializing an object”
exception at public ActionResult Data(){ … return new SchedulerAjaxData(events);} line
I am sure there are no circular reference. Here’s data dump from the DB:
Id text start_date end_date rec_type event_pid length biz_Id
2 New event 4/18/201211:30:00 AM 4/18/2012 12:30:00 PM NULL NULL 1
IN the biz table (the one referenced from here) there’s no reference to this table at all. I don’t understand where this circular reference coming from, maybe its just misleading message?
Please shed some light into this issue.
Thank you in advance!
Hi,
no, most likely, problem is in the reference, since this exception was thrown by serializer.
Check your models, orm can automatically build relations between them, and the linked objects will have references to each other. If you are using linq to sql, this issue can be fixed by editing the ‘Child Property’ of ‘Parent Property’ of the association between the models.
Thank you again Aliaksandr.
-
So what you saying is that I cannot have any circles anywhere inside my model, not even related to events table, correct?
-
Is that the reason in every sample I saw so far from dhtmlx events table always stands alone and glued with the rest of the model by Linq2SQL?
-
I use Entity Framework (rather than Linq2SQL), the model is like this:
event<->resource->resource type->user. Basically the same you had with rooms, but with more abstraction: can be room, can be person, can be anything.
So instead of querying user’s events directly, I will have to join users to resource types to resources to events. It will make my DB queries extremely inefficient, don’t you think?
It will practically make the model non scalable, because this 3 level join will take forever to perform having millions of records in every table.
-
What would you suggest in this case, if I cannot have loops in the model. Or am I getting it wrong and missing something?
Thank you again for your prompt help and support
1)No, you can’t have loops in the data which is passed to ‘SchedulerAjaxData’, since the data should be serialized to json, and json doesnt support circular references
2)actually i’m not sure why this part done exactly so) Events could be linked to the Rooms in the model as well. It will work if ‘Child Property’ of the the association will be disabled(ie Event won’t have link to related Room object, which is not essential for the samples)
3)I’m not sure if custom join will be much slower than quering model property. I mean that at the database level all of it will be done using sql queries
4)Maybe, in the Data action, you could select events as the objects of some other type, with only those properties, that will be used on the client, something like
.Select(ev => new RenderableEvent{
id = ev.id,
text = ev.text,
resourceId = ev.resourceId ,..})
where RenderableEvent will be the class with same properties as Event, except of link to the related Resource object
We plan to make data rendering more flexible, but for now there is no exact date when it will be updated
Hello again!
I found much nicer solution that does the job: instead of sending domain objects into the control (which have loops in data model), I want to create a viewmodel that has all the required fields of event (id, start_time etc including the recursion fields, rec_type, event_pid and event_length).
So I map domain event list into ViewModel one and send it to the control, which displays it beautifully.
Now: events that are non recursive are inserted, updated and deleted from the database alright.
As soon as I enable recursion on the event I get this exception from the control when trying to save it (before I get to Save action in the control):
Microsoft JScript runtime error: Unable to get value of the property ‘id’: object is null or undefined
if I ignore it, next exception is
Microsoft JScript runtime error: Unable to get value of the property ‘type’: object is null or undefined
and so on
These completely make no sense to me and I need your help, please.
Thank you in advance.
Aliaksandr,
Please find the project attached. I am kinda confident you’ll need to debug the code in order to see for yourself what’s going on.
Exceptions are clearly thrown from the scheduler before code even reaches the Save action.
I see no reason for and have no explanation to those exceptions.
Will PM you the password to the archive separately.
The scenario is
modify existing event or create new one
enable the recursion
hit the save button
Note that you will need to install AutoMapper and EntityFramework to compile this.
Thank you in advance!
… and now with the attachment 
Testing DHTMLX Scheduler.zip (1.12 MB)
Hello,
there is a strange bug in lightbox, recurring control works incorrectly if it’s placed after time-picker control. And its also sensitive to the name of that control. Sorry for the inconvinience, this bug will be fixed in one of upcoming updates.
As workaround you can use following configuration
scheduler.Lightbox.Add(new LightboxRecurringBlock("rec_type", "Recurring"));
scheduler.Lightbox.Add(new LightboxMiniCalendar("time", "Time") { MapTo = "auto" }); -RecurringBlock goes before mini calendar, and there is a few more magic values - name of the time-picker should be ‘time’, and it must be mapped to the ‘auto’ property
Thank you very much Aliaksandr.
I could figure it out on my own
.
Hi Aliaksandr,
I have found another very peculiar behaviour that you guys should look into:
in the following like, taken from your examles there’s hardcoded value of “room_id”.
var unitsView = new UnitsView(resourceType.Name, "room_id") { Label = resourceType.Name };
I tried to change it to my own ID values of my own object and unexpectedly (actually I was expecting this having working with scheduler control for some time now) refuses to add/update/delete events throwing exception of incorrect formatting at the following line:
var action = new DataAction(actionValues);
Funny thing is that I don’t have no rooms object in my code any more, but without that “room_id” the control is acting up.
For you to look into and for users to take into account.
Thanks & hope it helps somebody else as well.
Hello Aliaksandr,
In the example you’ve provided in this topic you have room_id as a resource attached to the event.
In situation when there’s dynamic list of multiple resources (x resources for 1 event and y resources for the other) I’ll have to have many to many relationship between events and resources, something like this: Event<---->Resource and in between event and resource tables there is link (or junction or cross-reference) table like this: (int EventID, int ResourceID).
My specific question is: how can I retrieve the list of resources that returns from control as soon as I hit “Save” button?
Can you please provide some sample code for that (the list setting up and the retrieving parts)?
Thank you in advance!
Hi,
control sends values in the request form, they will have same names as the properties of the model. They can be accessed like
var resourseId = this.Request.Form["ResourceId"]
orpublic ActionResult Save(int? id, FormCollection actionValues){
var resourseId = actionValues["ResourceId"]