fixed color-picker shown twice if used in a tab-widget after apply, backport of

r48992: disabling immediate direct call to loadingFinished() for selected tab seems to have no recognisable impact
and some widgets, eg. color-picker have problems with calling doLoadingFinished twice
r49047: change tab loading again to initialise visible tab immediatly and gard et2_color / jPicker against being initialised twice
This commit is contained in:
Ralf Becker 2014-10-17 12:14:44 +00:00
parent 8ef066f283
commit b1f48200e6
2 changed files with 17 additions and 9 deletions

View File

@ -99,7 +99,11 @@ var et2_color = et2_inputWidget.extend(
this._super.call(this, arguments);
},
doLoadingFinished: function() {
doLoadingFinished: function()
{
// as tabs can cause a double loading, we check here if jPicker is already initialised
if (this.get_jPicker()) return;
this._super.apply(this, arguments);
var self = this;
@ -163,14 +167,17 @@ var et2_color = et2_inputWidget.extend(
/**
* Get the jPicker object for this widget, so further things can be done to it
*
* Id of jPicker node is either our id+'_jPicker' or our dom_id (no idea why).
*/
get_jPicker: function() {
if(jQuery.jPicker.List.length)
for(var i=0; i < jQuery.jPicker.List.length; ++i)
{
var self = this;
return jQuery(jQuery.jPicker.List.filter(function(elem,index) {
return (elem && elem.id == self.id + "_jPicker");
}))[0];
var node = jQuery.jPicker.List[i];
if (node && (node.id == this.id+'_jPicker' || node.id == this.dom_id))
{
return node;
}
}
return null;
},

View File

@ -242,6 +242,7 @@ var et2_tabbox = et2_valueWidget.extend([et2_IInput],
window.setTimeout(function() {
for (var i = 0; i < tabs.tabData.length; i++)
{
if (i == tabs.selected_index) continue;
tabs._loadTab(i,promises);
}
jQuery.when.apply(jQuery,promises).then(function() {