Browse Source

Fixes #2534 for real, adds loadOnce setting

pull/4454/merge
Jack Lukic 8 years ago
parent
commit
0302ae93c7
2 changed files with 16 additions and 7 deletions
  1. 5
      RELEASE-NOTES.md
  2. 18
      src/definitions/modules/tab.js

5
RELEASE-NOTES.md

@ -2,11 +2,14 @@
### Version 2.2.8 - December 21, 2016
**Enhancements**
**Major Enhancements**
- **Icons** - Updates Font Awesome to `4.7.0` **Always the man @BreadMaker** #4766
- **Dropdown** - Added new setting `filterAPIResults` which when enabled will filter results locally by query after API returns, allowing your API call to return the full dropdown dataset. **Thanks @enix223** #4815
- **Tab** - Added setting `loadOnce`, which when enabled only calls remote endpoint for tab data on first load #2534
**Enhancements**
**Critical Bugs**
- **Dropdown** - `forceSelection` will no longer select value in `multiple selection dropdown` #4041 #4516

18
src/definitions/modules/tab.js

@ -476,7 +476,10 @@ $.fn.tab = function(parameters) {
settings.onFirstLoad.call($tab[0], tabPath, parameterArray, historyEvent);
settings.onLoad.call($tab[0], tabPath, parameterArray, historyEvent);
if(typeof settings.cacheType == 'string' && settings.cacheType.toLowerCase() == 'dom' && $tab.children().length > 0) {
if(settings.loadOnce) {
module.cache.add(fullTabPath, true);
}
else if(typeof settings.cacheType == 'string' && settings.cacheType.toLowerCase() == 'dom' && $tab.children().length > 0) {
setTimeout(function() {
var
$clone = $tab.children().clone(true)
@ -506,11 +509,13 @@ $.fn.tab = function(parameters) {
if(settings.cache && cachedContent) {
module.activate.tab(tabPath);
module.debug('Adding cached content', fullTabPath);
if(settings.evaluateScripts == 'once') {
module.update.content(tabPath, cachedContent, false);
}
else {
module.update.content(tabPath, cachedContent);
if(!settings.loadOnce) {
if(settings.evaluateScripts == 'once') {
module.update.content(tabPath, cachedContent, false);
}
else {
module.update.content(tabPath, cachedContent);
}
}
settings.onLoad.call($tab[0], tabPath, parameterArray, historyEvent);
}
@ -898,6 +903,7 @@ $.fn.tab.settings = {
alwaysRefresh : false, // load tab content new every tab click
cache : true, // cache the content requests to pull locally
loadOnce : false, // Whether tab data should only be loaded once when using remote content
cacheType : 'response', // Whether to cache exact response, or to html cache contents after scripts execute
ignoreFirstLoad : false, // don't load remote content on first load

Loading…
Cancel
Save