Skip to content

Commit e369290

Browse files
author
Andrew Perlitch
committed
added api binding
1 parent fc1e3e1 commit e369290

File tree

4 files changed

+34
-4
lines changed

4 files changed

+34
-4
lines changed

README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ The options object should be available on the parent scope of the `<ap-mesa>` el
103103
| bodyHeight | `number` | 300 | The pixel height for the body of the table. Note that unless `fixedHeight` is set to true, this will behave as a max-height. |
104104
| fillHeight | `boolean` | false | If true, the table will fill the calculated height of the parent element. Note that this overrides `bodyHeight`. The table will listen for `'apMesa:resize'` events from the rootScope to recalculate the height. |
105105
| fixedHeight | `boolean` | false | If true, the table body will always have a height of `bodyHeight`, regardless of whether the rows fill up the vertical space. |
106-
| onRegisterApi | `function` | {} | Provides a access to select table controller methods, including selectAll, deselectAll, isSelectedAll, setLoading, etc. |
106+
| onRegisterApi | `function` | {} | Provides a access to select table controller methods, including selectAll, deselectAll, isSelectedAll, setLoading, etc. See [*Table API*](https://github.com/andyperlitch/angularjs-table#table-api). |
107107
| getter | `function` | {} | Customize the way to get column value. If not specified, get columen value by row[column.key] |
108108
| expandableTemplateUrl | `String` | undefined | A template reference to be used for the expandable row feature. See [*Expandable Rows*](https://github.com/andyperlitch/angularjs-table#expandable-rows). |
109109
| expandableTemplate | `String` | undefined | A template string to be used for the expandable row feature. See [*Expandable Rows*](https://github.com/andyperlitch/angularjs-table#expandable-rows). |
@@ -428,6 +428,34 @@ You can update the value of `enabledColumns` from the outside to manipulate the
428428
As with normal two-way bound inputs, this value will update as sorting is changed via drag-and-drop by the user.
429429

430430

431+
Table API
432+
---------
433+
434+
When a table is instantiated, it creates an API object with several methods that allow you to programmatically control parts of the table.
435+
436+
There are two ways to access the API. One is to use the `onRegisterApi` option, e.g.:
437+
438+
```js
439+
var tableApi;
440+
$scope.tableOptions = {
441+
// other options
442+
onRegisterApi: function(api) {
443+
tableApi = api;
444+
}
445+
}
446+
```
447+
448+
The other way is to use the optional binding on the element itself, e.g.:
449+
450+
```html
451+
<ap-mesa
452+
columns="vm.columns"
453+
rows="vm.rows"
454+
api="vm.api">
455+
</ap-mesa>
456+
```
457+
458+
431459
Browser Support
432460
---------------
433461
IE 9+

dist/ap-mesa.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,8 @@ angular.module('apMesa.controllers.ApMesaController', [
835835
enabledColumns: '=?',
836836
selected: '=',
837837
options: '=?',
838-
trackBy: '@?'
838+
trackBy: '@?',
839+
api: '=?'
839840
},
840841
controller: 'ApMesaController',
841842
compile: function (tElement) {

dist/ap-mesa.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/directives/apMesa.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,8 @@
468468
enabledColumns: '=?',
469469
selected: '=',
470470
options: '=?',
471-
trackBy: '@?'
471+
trackBy: '@?',
472+
api: '=?'
472473
},
473474
controller: 'ApMesaController',
474475
compile: function(tElement) {

0 commit comments

Comments
 (0)