mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
fixing tab force active
Wasn't getting li, plus was find tabs in child tabsets
This commit is contained in:
parent
eeacbb1b95
commit
95d0ed486c
@ -813,26 +813,36 @@ jQuery.noConflict();
|
|||||||
sessionStates = sessionData ? JSON.parse(sessionData) : false;
|
sessionStates = sessionData ? JSON.parse(sessionData) : false;
|
||||||
|
|
||||||
this.find('.cms-tabset, .ss-tabset').each(function() {
|
this.find('.cms-tabset, .ss-tabset').each(function() {
|
||||||
var index, tabset = $(this), tabsetId = tabset.attr('id'), tab,
|
var index,
|
||||||
forcedTab = tabset.find('.ss-tabs-force-active');
|
tabset = $(this),
|
||||||
|
tabsetId = tabset.attr('id'),
|
||||||
|
tab,
|
||||||
|
forcedTab = tabset.children('ul').children('li.ss-tabs-force-active');
|
||||||
|
|
||||||
if(!tabset.data('tabs')) return; // don't act on uninit'ed controls
|
if(!tabset.data('tabs')) return; // don't act on uninit'ed controls
|
||||||
|
|
||||||
// The tabs may have changed, notify the widget that it should update its internal state.
|
// The tabs may have changed, notify the widget that it should update its internal state.
|
||||||
tabset.tabs('refresh');
|
tabset.tabs('refresh');
|
||||||
|
|
||||||
// Make sure the intended tab is selected.
|
// Make sure the intended tab is selected. Only force the tab on the correct tabset though
|
||||||
if(forcedTab.length) {
|
if(forcedTab.length) {
|
||||||
index = forcedTab.index();
|
index = forcedTab.first().index();
|
||||||
} else if(overrideStates && overrideStates[tabsetId]) {
|
} else if(overrideStates && overrideStates[tabsetId]) {
|
||||||
tab = tabset.find(overrideStates[tabsetId].tabSelector);
|
tab = tabset.find(overrideStates[tabsetId].tabSelector);
|
||||||
if(tab.length) index = tab.index();
|
if(tab.length) index = tab.index();
|
||||||
} else if(sessionStates) {
|
} else if(sessionStates) {
|
||||||
$.each(sessionStates, function(i, sessionState) {
|
$.each(sessionStates, function(i, state) {
|
||||||
if(tabset.is('#' + sessionState.id)) index = sessionState.selected;
|
if(tabsetId == state.id) {
|
||||||
});
|
tabset.tabs('select', state.selected);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
index = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(index !== null) {
|
||||||
|
tabset.tabs('select', index);
|
||||||
}
|
}
|
||||||
if(index !== null) tabset.tabs('select', index);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user