Skip to content

Commit

Permalink
Refresh method.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulhodel authored and paulhodel committed Dec 12, 2019
1 parent 392954f commit 0cd29c5
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 2 deletions.
36 changes: 34 additions & 2 deletions dist/jexcel.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/**
* jExcel v3.7.1
* jExcel v3.7.2
*
* Author: Paul Hodel <[email protected]>
* Website: https://bossanova.uk/jexcel/
Expand Down Expand Up @@ -193,7 +193,7 @@ var jexcel = (function(el, options) {
noCellsSelected: 'No cells selected',
},
// About message
about:"jExcel CE Spreadsheet\nVersion 3.7.1\nAuthor: Paul Hodel <[email protected]>\nWebsite: https://bossanova.uk/jexcel/v3",
about:"jExcel CE Spreadsheet\nVersion 3.7.2\nAuthor: Paul Hodel <[email protected]>\nWebsite: https://bossanova.uk/jexcel/v3",
};

// Loading initial configuration from user
Expand Down Expand Up @@ -605,6 +605,38 @@ var jexcel = (function(el, options) {
obj.setStyle(obj.options.style, null, null, 1, 1);
}
}

/**
* Refresh the data
*
* @return void
*/
obj.refresh = function() {
if (obj.options.url) {
// Loading
if (obj.options.loadingSpin == true) {
jSuites.loading.show();
}

jSuites.ajax({
url: obj.options.url,
method: 'GET',
dataType: 'json',
success: function(result) {
// Data
obj.options.data = (result.data) ? result.data : result;
// Prepare table
obj.setData();
// Hide spin
if (obj.options.loadingSpin == true) {
jSuites.loading.hide();
}
}
});
} else {
obj.setData();
}
}

/**
* Set data
Expand Down
32 changes: 32 additions & 0 deletions src/js/jexcel.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,38 @@ var jexcel = (function(el, options) {
}
}

/**
* Refresh the data
*
* @return void
*/
obj.refresh = function() {
if (obj.options.url) {
// Loading
if (obj.options.loadingSpin == true) {
jSuites.loading.show();
}

jSuites.ajax({
url: obj.options.url,
method: 'GET',
dataType: 'json',
success: function(result) {
// Data
obj.options.data = (result.data) ? result.data : result;
// Prepare table
obj.setData();
// Hide spin
if (obj.options.loadingSpin == true) {
jSuites.loading.hide();
}
}
});
} else {
obj.setData();
}
}

/**
* Set data
*
Expand Down

0 comments on commit 0cd29c5

Please sign in to comment.