Commit 6ad63399 by NGUYEN HOANG SON

implement change dashboard setting callback

parent 43bb1ed4
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
*/ */
var DashboardSetting = {}; var DashboardSetting = {};
DashboardSetting.changeSettingCallback = function() {};
/** /**
* Html element array, map with json key from setting data API * Html element array, map with json key from setting data API
*/ */
...@@ -84,6 +86,9 @@ DashboardSetting.saveSetting = function () { ...@@ -84,6 +86,9 @@ DashboardSetting.saveSetting = function () {
const url = DashboardSetting.baseApiUrl + 'saveSetting'; const url = DashboardSetting.baseApiUrl + 'saveSetting';
COMMON.cmsAjax(url, param, false, function (json) { COMMON.cmsAjax(url, param, false, function (json) {
DashboardSetting.closeModal(); DashboardSetting.closeModal();
if (DashboardSetting.changeSettingCallback && typeof DashboardSetting.changeSettingCallback === 'function') {
DashboardSetting.changeSettingCallback();
}
}, function() { }, function() {
console.log('DashboardSetting.saveSetting error'); console.log('DashboardSetting.saveSetting error');
DashboardSetting.closeModal(); DashboardSetting.closeModal();
...@@ -110,12 +115,14 @@ DashboardSetting.bindToggleClick = function () { ...@@ -110,12 +115,14 @@ DashboardSetting.bindToggleClick = function () {
/** /**
* init data, action when screen onload * init data, action when screen onload
* @param {function} changeCallback - callback when settings changed
*/ */
DashboardSetting.init = function () { DashboardSetting.init = function (changeCallback) {
DashboardSetting.getSettingData(function (settings) { DashboardSetting.getSettingData(function (settings) {
DashboardSetting.applySettings(settings); DashboardSetting.applySettings(settings);
}); });
DashboardSetting.bindToggleClick(); DashboardSetting.bindToggleClick();
DashboardSetting.changeSettingCallback = changeCallback;
}; };
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment