I have a custom lightbox section dealing with the date handling and do not use the normal time section.
I also use the MiniCal extension, and I have set the following config.
scheduler.config.full_day = true
In the onCreateEvent, I set ev.fullday = true because I don’t have a checkbox.
When I check ev.fullday in the SetValue of my custom lightbox section, it is correctly displayed as true, but if I check ev.fullday in the GetValue of my custom lightbox section it is undefined.
I thought that it will be part of the event object and accessible during the GetValue. Could something in the MiniCal extension be resetting it?
Schedulre itself doesn’t set ev.fullday in any scenario ( even when fullday checkbox is enabled, its value affects start and end dates only )
Most probably you have a custom section which has map_to:“fullday”, but its get_value doesn’t return anything. Scheduler will set result of get_value to property configured by “map_to”, if get_value returns nothing - it will result in “undefined” value.
I don’t have any inputs for fullday that the get_value could be taking it from.
If I set the value of ev.fullday using the following code, shouldn’t it be part of the ev object and persist and therefore be available in the get_value function of my custom section?
scheduler.addEventNow({
fullday: true
});
If you look at the snippets that I provided above, you will see that there is no reference to fullday that get_value could be taking from.
As the function is defined as
get_value:function(node, ev)
shouldn’t ev contain all the event object properties?
Lightbox is called and each of the various sections’ set_value are called to populate the correct values into the input elements.
When the SAVE button is pressed, each of the various sections’ get_value are called and whatever code is present in each of the get_value functions is run, so, in the get_value, we can use custom code to move values from the inputs to the event object (ev)
Could you correct me if I have misunderstood the process?
I added some additional testing by adding the extra fields that are defined in the documentation for addEventNow.
So, I am now creating the following
scheduler.addEventNow({
start_date: new Date(2011,5,13,15),
end_date: new Date(2011,5,13,18),
text: "My new event",
custom_data: "some data",
mycustomvalue: "dhtmlx",
fullday: true
});
in set_value of my custom section, I can access ALL of the properties of the ev object (see image 1 below)
in get_value of my custom section, I can access NONE of the properties of the ev object EXCEPT ev.text which is the only event property which has a corresponding INPUT on the lightbox. (see image 2 below)
So, it seems that in get_value it is only possible to access ev properties that have corresponding inputs on screen. Is that correct?
Actually not, while set_value contains full event object, in getter it is not guaranteed. It just an object on which you can set custom attributes which will be later transfered on event ( you can think about it as write-only event object )
so, in the get_value, we can use custom code to move values from the inputs to the event object (ev)
That is right, but you can only write values to that ev object, reading from it not reliable.
If you need to have some logic which must work with results from different sections, you can store each section through get_value and use login in onEventSave handler to produce combined value.
Am I correct in assuming that the data object is the “write-only” event object that is also available via ev of the get_value functions of the lightbox sections?
So to check the current value of a custom_event_property that has NOT been part of the lightbox, I must use the id parameter and do scheduler.getEvent(id).custom_event_property to get the value?
For any properties that have been set via the lightbox, I will be able to get them by data.custom_event_property_set_in_lightbox
Something like
scheduler.attachEvent("onEventSave",function(id,data,is_new_event){
// get an event property NOT USED in lightbox
var custom_value1 = scheduler.getEvent(id).custom_event_property;
// get an event property USED in lightbox
var custom_value2 = data.custom_event_property_set_in_lightbox;
}
Also, the various properties of the data object will be merged into the ev object after the onEventSave
Sorry for reviving an old topic, but I think this is actually a bug which still exists. The event passed into GetValue is an empty object when really it should be the event in question. In the dhtmlxscheduler.js file there is the following function definition: scheduler.save_lightbox = function () { var e = this._lightbox_out({}, this._lame_copy( this.getEvent(this._lightbox_id)));...
You’ll notice that _lightbox_out is being called with 2 arguments (an empty object and the result of a call to _lame_copy) and the call to _lame_copy with a single argument. However the function _lightbox_out only accepts one argument, whereas _lame_copy requires 2 arguments (copying the properties of one to the other).
I think the intent of the code is to call _lightbox_out with a copy of the event (rather than a reference to it). This object is what gets passed into GetValue. Because it is an empty object currently, that is why the event properties are not available. If the code were changed to:
scheduler.save_lightbox = function () { var e = this._lightbox_out(this._lame_copy({}, this.getEvent(this._lightbox_id)));...
then all works beautifully - you have your event properties (and when you the onEventSave function is called, your properties have not mysteriously reverted which they do currently!).
Get a guaranteed answer from DHTMLX technical support team
under the most suitable support plan