AngularJS directive for those using HTML tables and jaydata.
$ bower install angular-jaydata-table
var MyApp = angular.module('myModule', ['angular-jaydata-table']);
<jay-table list="list" options="options" selected-items="selectedItems"></jay-table>
MyApp.controller("MyController", function ($scope, $data, jayTableOptions) {
$scope.list = [];
$scope.selectedItems = [];
$data //Jaydata service
.initService(<odata-url>)
.then(function (odataContext) {
odataContext
.School
.toArray()
.then(function (school) {
$scope.$apply(function () {
$scope.list = school;
});
});
})
jayTableOptions
.initializeHeader()
.addColumn("Name")
.addColumn("Address")
$scope.options = jayTableOptions;
});
Set default empty table text, if you prefer.
MyApp.config(function (jayTableConfigProvider) {
jayTableConfigProvider.setEmptyText('This table is empty!');
});
Take a look at directive in action and demo project to see more options.