-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Closed
Milestone
Description
Hey guys, so there doesn't seem to be an easy option to display a message in the event of an empty grid. I was able to use the directive below which I got from #496. But that seemed to have been closed because it was a 2.x problem. Do you think a functionality like this could be added?
.directive('showEmptyMsg', function ($compile, $timeout) {
return {
restrict: 'A',
link: function (scope, element, attrs) {
var msg = (attrs.showEmptyMsg) ? attrs.showEmptyMsg : 'Nothing to display';
var template = "<p ng-hide='data.length'><b>" + msg + "</b></p>";
var tmpl = angular.element(template);
$compile(tmpl)(scope);
$timeout(function () {
element.find('.ui-grid-viewport').append(tmpl);
}, 0);
}
};
})