forked from extern/egroupware
Fix some issues causing problems with existing taglists:
- Some account widgets were not finding accounts through selectbox - Setting a single value was causing an error
This commit is contained in:
parent
2ff7313efc
commit
782c54976b
@ -39,7 +39,7 @@ var et2_taglist = et2_selectbox.extend(
|
|||||||
"select_options": {
|
"select_options": {
|
||||||
"type": "any",
|
"type": "any",
|
||||||
"name": "Select options",
|
"name": "Select options",
|
||||||
"default": null, //[{id: "a", label: "Alpha"},{id:"b", label: "Beta"}],
|
"default": {}, //[{id: "a", label: "Alpha"},{id:"b", label: "Beta"}],
|
||||||
"description": "Internaly used to hold the select options."
|
"description": "Internaly used to hold the select options."
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -171,8 +171,8 @@ var et2_taglist = et2_selectbox.extend(
|
|||||||
this.taglist_options = jQuery.extend( {
|
this.taglist_options = jQuery.extend( {
|
||||||
// magisuggest can NOT work setting an empty autocomplete url, it will then call page url!
|
// magisuggest can NOT work setting an empty autocomplete url, it will then call page url!
|
||||||
// --> setting an empty options list instead
|
// --> setting an empty options list instead
|
||||||
data: this.options.select_options && !jQuery.isEmptyObject(this.options.select_options) ?
|
data: this.options.autocomplete_url ? this.options.autocomplete_url :
|
||||||
this.options.select_options || {} : this.options.autocomplete_url,
|
this.options.select_options || {},
|
||||||
dataUrlParams: this.options.autocomplete_params,
|
dataUrlParams: this.options.autocomplete_params,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
displayField: "label",
|
displayField: "label",
|
||||||
@ -215,16 +215,6 @@ var et2_taglist = et2_selectbox.extend(
|
|||||||
// Bind keyup so we can start ajax search when we like
|
// Bind keyup so we can start ajax search when we like
|
||||||
.on('keyup.start_search', jQuery.proxy(this._keyup, this));
|
.on('keyup.start_search', jQuery.proxy(this._keyup, this));
|
||||||
|
|
||||||
// Unbind change handler of widget's ancestor to stop it from bubbling
|
|
||||||
// taglist has its own onchange
|
|
||||||
$j(this.getDOMNode()).unbind('change.et2_inputWidget');
|
|
||||||
|
|
||||||
// onChange
|
|
||||||
if(this.options.onchange && typeof this.onchange === 'function')
|
|
||||||
{
|
|
||||||
this.$taglist.on("selectionchange", this.onchange);
|
|
||||||
}
|
|
||||||
|
|
||||||
// onClick - pass more than baseWidget, so unbind it to avoid double callback
|
// onClick - pass more than baseWidget, so unbind it to avoid double callback
|
||||||
if(typeof this.onclick == 'function')
|
if(typeof this.onclick == 'function')
|
||||||
{
|
{
|
||||||
@ -403,7 +393,9 @@ var et2_taglist = et2_selectbox.extend(
|
|||||||
*/
|
*/
|
||||||
set_value: function(value)
|
set_value: function(value)
|
||||||
{
|
{
|
||||||
this.options.value = value;
|
var values = jQuery.isArray(value) ? jQuery.extend([],value) : [value];
|
||||||
|
this.options.value = values;
|
||||||
|
|
||||||
if(this.taglist == null) return;
|
if(this.taglist == null) return;
|
||||||
|
|
||||||
if(!value)
|
if(!value)
|
||||||
@ -412,7 +404,6 @@ var et2_taglist = et2_selectbox.extend(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var values = jQuery.isArray(value) ? jQuery.extend([],value) : [value];
|
|
||||||
var result = [];
|
var result = [];
|
||||||
for(var i=0; i < values.length; ++i)
|
for(var i=0; i < values.length; ++i)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user