Get section [ID/name] when in unitview

I created a unit view with the following code:

... code ...

scheduler.locale.labels.persoon_tab = "Persoon"
  // Get persons through JSON call  
  var personen = [];
        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
... 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);

        ... 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?


scheduler.attachEvent("onExternalDragIn", function(id, source, e){ var label = tree.getItemText(tree._dragged[0].id); var ev = scheduler.getEvent(id); ev.text = label; var section_id = ev.section_id; // name of the property I use in this sample var units_view = scheduler._props.unit; // unit - name of my units view var section = units_view.options[units_view.order[section_id]]; // options object return true; });
Best regards,

var ev = scheduler.getEvent(id);
var user = ev.mwr_contact_id;

This did the trick for me! (mwr_contact_id was the name of my property)/

Thanks very much!