Fix resource (contact, resource, etc.) label sometimes not found

This commit is contained in:
nathangray 2016-06-15 08:51:07 -06:00
parent 695a72e3e8
commit 358df21fd2
2 changed files with 31 additions and 1 deletions

View File

@ -832,7 +832,7 @@ var et2_taglist = (function(){ "use strict"; return et2_selectbox.extend([et2_IR
var min_width = jQuery('.ms-sel-item',this.div ).first().outerWidth() || this.div.children().first().width();
// Not ready yet
if(min_width === null) return;
if(min_width === null || !this.taglist) return;
min_width += (this.options.multiple === 'toggle' ? jQuery('.toggle',this.div).outerWidth() : 0);
min_width += this.taglist.trigger ? this.taglist.trigger.outerWidth(true) : 0;

View File

@ -90,6 +90,36 @@ var et2_calendar_owner = (function(){ "use strict"; return et2_taglist_email.ext
{
if(this.taglist == null) return null;
return this.taglist.getValue();
},
/**
* Override parent to handle our special additional data types (c#,r#,etc.) when they
* are not available client side.
*
* @param {string|string[]} _value array of selected owners, which can be a number,
* or a number prefixed with one character indicating the resource type.
*/
set_value: function(_value)
{
this._super.apply(this, arguments);
// If parent didn't find a label, label will be the same as ID so we
// can find them that way
for(var i = 0; i < this.options.value.length; i++)
{
var value = this.options.value[i];
if(value.id == value.label)
{
// Proper label was not fount by parent - ask directly
egw.json('calendar_owner_etemplate_widget::ajax_owner',value.id,function(data) {value.label = data;}, this).sendRequest();
}
}
if(this.taglist)
{
this.taglist.clear(true);
this.taglist.addToSelection(this.options.value,true);
}
}
});}).call(this);
et2_register_widget(et2_calendar_owner, ["calendar-owner"]);