N°3928 Use right tab widget in impact analysis and make sure widget is initialized before using it

This commit is contained in:
Stephen Abello
2021-08-24 10:30:08 +02:00
parent d4b515c7b7
commit 06b1e581fe
2 changed files with 32 additions and 18 deletions

View File

@@ -100,6 +100,17 @@ $(function()
this.element.regulartabs(oParams); this.element.regulartabs(oParams);
} }
}, },
/**
* Return tabs widget instance
* @public
*/
GetTabWidget: function () {
if (this.element.hasClass(this.css_classes.is_scrollable)) {
return this.element.scrollabletabs('instance');
} else {
return this.element.regulartabs('instance');
}
},
// events bound via _bind are removed automatically // events bound via _bind are removed automatically
// revert other modifications here // revert other modifications here
_destroy: function() _destroy: function()

View File

@@ -466,7 +466,7 @@ $(function()
{ {
this._close_all_tooltips(); this._close_all_tooltips();
// Activate the 3rd tab // Activate the 3rd tab
this.element.closest('.ui-tabs').tabs("option", "active", 2); this.element.closest('[data-role="ibo-tab-container"]').tab_container("GetTabWidget").option("active", 2);
// Scroll into view the group // Scroll into view the group
if ($('#'+sGroupId).length > 0) if ($('#'+sGroupId).length > 0)
{ {
@@ -698,7 +698,6 @@ $(function()
}, },
_on_resize: function() _on_resize: function()
{ {
this.element.closest('.ui-tabs').tabs({ heightStyle: "content" });
this.auto_scale(); this.auto_scale();
this._close_all_tooltips(); this._close_all_tooltips();
this.draw(); this.draw();
@@ -754,25 +753,29 @@ $(function()
}, },
refresh_groups: function(aGroups) refresh_groups: function(aGroups)
{ {
if ($('#impacted_groups').length > 0) if(this.element.parents('.ibo-tab-container').attr('data-status') === 'loaded'){
{ if ($('#impacted_groups').length > 0)
// The "Groups" tab is present, refresh it
if (aGroups.length == 0)
{ {
this.element.closest('.ui-tabs').tabs("disable", 2); // The "Groups" tab is present, refresh it
$('#impacted_groups').html(''); if (aGroups.length == 0)
} {
else this.element.closest('[data-role="ibo-tab-container"]').tab_container("GetTabWidget").disable(2);
{ $('#impacted_groups').html('');
this.element.closest('.ui-tabs').tabs("enable", 2); }
$('#impacted_groups').html('<img src="../images/indicator.gif">'); else
var sUrl = GetAbsoluteUrlAppRoot()+'pages/ajax.render.php'; {
$.post(sUrl, { operation: 'relation_groups', groups: aGroups }, function(data) { this.element.closest('[data-role="ibo-tab-container"]').tab_container("GetTabWidget").enable(2);
$('#impacted_groups').html(data); $('#impacted_groups').html('<img src="../images/indicator.gif">');
}); var sUrl = GetAbsoluteUrlAppRoot()+'pages/ajax.render.php';
$.post(sUrl, { operation: 'relation_groups', groups: aGroups }, function(data) {
$('#impacted_groups').html(data);
});
}
} }
} }
else{
setTimeout(this.refresh_groups(aGroups), 800);
}
}, },
refresh_lists: function(aLists) refresh_lists: function(aLists)
{ {