Skip to content

Commit 972fcc8

Browse files
Added "refresh" method to table api to keep table values in sync with server.
1 parent 531b996 commit 972fcc8

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

angular-mesa.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ declare namespace angular.apMesa {
9090
deselectAll: () => void;
9191
toggleSelectAll: () => void;
9292
setLoading: (isLoading: boolean, triggerDigest?: boolean) => void;
93+
// In case if server values are keep changing, refresh can be called programmatically to keep the table data in sync with server.
94+
refresh: () => void;
9395
reset: () => void;
9496
clearFilters: () => void;
9597
// Resets rows' sorting order to whatever options.initialSorts. You can also pass an explicit array of IInitialSort objects.

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angularjs-table",
3-
"version": "2.21.5",
3+
"version": "2.21.6",
44
"main": [
55
"./dist/ap-mesa.js",
66
"./dist/ap-mesa.css"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angularjs-table",
3-
"version": "2.21.5",
3+
"version": "2.21.6",
44
"license": "Apache License, v2.0",
55
"dependencies": {
66
"angular": "^1.6",

src/directives/apMesa.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,11 @@
448448
scope.$digest();
449449
}
450450
},
451+
refresh: function() {
452+
if (scope.options.getData) {
453+
scope.$broadcast('apMesa:forceRefresh');
454+
}
455+
},
451456
reset: function() {
452457
scope.resetOffset();
453458
resetState(scope);

0 commit comments

Comments
 (0)