fixed CardRefresh doubled load if loadOnInit is true
This commit is contained in:
@@ -62,12 +62,6 @@ const CardRefresh = (($) => {
|
||||
if (this._settings.source === '') {
|
||||
throw new Error('Source url was not defined. Please specify a url in your CardRefresh source option.');
|
||||
}
|
||||
|
||||
this._init();
|
||||
|
||||
if (this._settings.loadOnInit) {
|
||||
this.load();
|
||||
}
|
||||
}
|
||||
|
||||
load() {
|
||||
@@ -112,6 +106,10 @@ const CardRefresh = (($) => {
|
||||
$(this).find(this._settings.trigger).on('click', () => {
|
||||
this.load()
|
||||
})
|
||||
|
||||
if (this._settings.loadOnInit) {
|
||||
this.load()
|
||||
}
|
||||
}
|
||||
|
||||
// Static
|
||||
@@ -127,7 +125,7 @@ const CardRefresh = (($) => {
|
||||
|
||||
if (typeof config === 'string' && config.match(/load/)) {
|
||||
data[config]()
|
||||
} else if (typeof config === 'object') {
|
||||
} else {
|
||||
data._init($(this))
|
||||
}
|
||||
}
|
||||
@@ -146,6 +144,12 @@ const CardRefresh = (($) => {
|
||||
CardRefresh._jQueryInterface.call($(this), 'load')
|
||||
})
|
||||
|
||||
$(document).ready(function () {
|
||||
$(Selector.DATA_REFRESH).each(function() {
|
||||
CardRefresh._jQueryInterface.call($(this))
|
||||
})
|
||||
})
|
||||
|
||||
/**
|
||||
* jQuery API
|
||||
* ====================================================
|
||||
|
||||
17
dist/js/adminlte.js
vendored
17
dist/js/adminlte.js
vendored
@@ -1406,12 +1406,6 @@
|
||||
if (this._settings.source === '') {
|
||||
throw new Error('Source url was not defined. Please specify a url in your CardRefresh source option.');
|
||||
}
|
||||
|
||||
this._init();
|
||||
|
||||
if (this._settings.loadOnInit) {
|
||||
this.load();
|
||||
}
|
||||
}
|
||||
|
||||
var _proto = CardRefresh.prototype;
|
||||
@@ -1459,6 +1453,10 @@
|
||||
$(this).find(this._settings.trigger).on('click', function () {
|
||||
_this.load();
|
||||
});
|
||||
|
||||
if (this._settings.loadOnInit) {
|
||||
this.load();
|
||||
}
|
||||
} // Static
|
||||
;
|
||||
|
||||
@@ -1474,7 +1472,7 @@
|
||||
|
||||
if (typeof config === 'string' && config.match(/load/)) {
|
||||
data[config]();
|
||||
} else if (typeof config === 'object') {
|
||||
} else {
|
||||
data._init($(this));
|
||||
}
|
||||
};
|
||||
@@ -1494,6 +1492,11 @@
|
||||
|
||||
CardRefresh._jQueryInterface.call($(this), 'load');
|
||||
});
|
||||
$(document).ready(function () {
|
||||
$(Selector.DATA_REFRESH).each(function () {
|
||||
CardRefresh._jQueryInterface.call($(this));
|
||||
});
|
||||
});
|
||||
/**
|
||||
* jQuery API
|
||||
* ====================================================
|
||||
|
||||
2
dist/js/adminlte.js.map
vendored
2
dist/js/adminlte.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/js/adminlte.min.js
vendored
2
dist/js/adminlte.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/js/adminlte.min.js.map
vendored
2
dist/js/adminlte.min.js.map
vendored
File diff suppressed because one or more lines are too long
@@ -1169,7 +1169,7 @@
|
||||
<h3 class="card-title">Card Refresh</h3>
|
||||
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-tool" data-card-widget="card-refresh" data-source="/pages/widgets.html" data-source-selector="#card-refresh-content"><i class="fas fa-sync-alt"></i></button>
|
||||
<button type="button" class="btn btn-tool" data-card-widget="card-refresh" data-source="widgets.html" data-source-selector="#card-refresh-content"><i class="fas fa-sync-alt"></i></button>
|
||||
</div>
|
||||
<!-- /.card-tools -->
|
||||
</div>
|
||||
@@ -1191,7 +1191,7 @@
|
||||
<h3 class="card-title">All together</h3>
|
||||
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-tool" data-card-widget="card-refresh" data-source="/pages/widgets.html" data-source-selector="#card-refresh-content"><i class="fas fa-sync-alt"></i></button>
|
||||
<button type="button" class="btn btn-tool" data-card-widget="card-refresh" data-source="widgets.html" data-source-selector="#card-refresh-content" data-load-on-init="false"><i class="fas fa-sync-alt"></i></button>
|
||||
<button type="button" class="btn btn-tool" data-card-widget="maximize"><i class="fas fa-expand"></i></button>
|
||||
<button type="button" class="btn btn-tool" data-card-widget="collapse"><i class="fas fa-minus"></i></button>
|
||||
<button type="button" class="btn btn-tool" data-card-widget="remove"><i class="fas fa-times"></i></button>
|
||||
|
||||
Reference in New Issue
Block a user