[Tables] #801 Documented MctTable directive

This commit is contained in:
Henry
2016-04-04 21:10:13 -07:00
parent 99ba9edb95
commit 20672ad028
7 changed files with 136 additions and 16 deletions

View File

@ -85,7 +85,7 @@ define(
then: function (callback) {
return fastPromise(callback(returnValue));
}
}
};
}
/**

View File

@ -68,6 +68,10 @@ define(
RealtimeTableController.prototype = Object.create(TableController.prototype);
/**
* Overrides method on TelemetryTableController providing handling
* for realtime data.
*/
RealtimeTableController.prototype.addRealtimeData = function() {
var self = this,
datum,
@ -89,7 +93,7 @@ define(
self.$scope.rows.length - 1);
}
});
}
};
return RealtimeTableController;
}

View File

@ -55,8 +55,15 @@ define(
$scope.columnsForm = {};
function unlisten() {
self.listeners.forEach(function (listener) {
listener();
});
}
$scope.$watch('domainObject', function(domainObject) {
self.populateForm(domainObject.getModel());
unlisten();
self.populateForm(domainObject.getModel());
self.listeners.push(self.domainObject.getCapability('mutation').listen(function (model) {
self.populateForm(model);
@ -79,11 +86,7 @@ define(
/**
* Destroy all mutation listeners
*/
$scope.$on('$destroy', function () {
self.listeners.forEach(function (listener) {
listener();
});
})
$scope.$on('$destroy', unlisten);
}

View File

@ -77,7 +77,7 @@ define(
return listener && listener();
});
this.changeListeners = [];
}
};
/**
* Defer registration of change listeners until domain object is
@ -156,7 +156,7 @@ define(
if (handle) {
handle.promiseTelemetryObjects().then(function () {
self.$scope.headers = []
self.$scope.headers = [];
self.$scope.rows = [];
table.populateColumns(handle.getMetadata());