I created a unit view with the following code:
... code ...
scheduler.locale.labels.persoon_tab = "Persoon"
// Get persons through JSON call
var personen = [];
$.ajax({
url: APP_URL + 'ajax.php',
dataType: 'json',
data: 'do=getMedewerkers' + urlParams,
async: false,
success: function(json){
personen = json;
}
});
// Create the view, the property is the ID from the person
scheduler.createUnitsView({
name:"persoon",
property:"wbn_medewerker_id",
list:personen
});
... more code ...
From here, when I go to this view, I can see the persons next to eachother. Items are also shown in the column of the person it belongs to.
When I create a new item (either through external drag in with dhtmlxTree or when I select some time slots) I want the ID of the person who’s column I’m creating the item, so I can autofill that in the form.
This is the code I’ve got so far:
scheduler.attachEvent("onExternalDragIn", function (id, source, event){
scheduler._on_mouse_up = function(e){
var pos = this._mouse_coords(e);
alert(pos.x);
}
... other code (fill form etc...)
It doesn’t matter what I try to print, but pos.x is always 0, where pos.y gives a slot index.
When I dump this line, I get:
alert(dump(scheduler._props['persoon'].options)); // dump() is a custom function, similar to PHP print_r();
// Result
'0' ...
'key' => "1"
'label' => "Administrator"
'1' ...
'key' => "2"
'label' => "Ivo - 50"
Can anyone help me to get the unit ID, or the name?