question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

There is no grid option to display a message if the grid is empty

See original GitHub issue

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 https://github.com/angular-ui/ng-grid/issues/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);
            }
        };
    })

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
c0bracommented, Jan 20, 2015

You can transclude anything you want into the grid. Here’s a plunker showing how to do a “No Rows” message: http://plnkr.co/edit/156wBdD5ogLGcKamP3lJ?p=preview

0reactions
jamespsterlingcommented, Sep 27, 2017

@c0bra much appreciated!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Display a message within the Kendo grid when it's empty
I've purposely misspelled the data route, in order to have an empty grid. To see it with content, simply comment / uncomment these...
Read more >
Show a message when the grid is empty | Infragistics Forums
I want to show a message (in the grid) when there is no data shown in the grid. I want to include the...
Read more >
how to display empty gridview with a message "No data ...
I want to display Empty Gridview with the message "No Data Available" ... Then bind the grid with this table when there is...
Read more >
Grid says "No items to display", but the request and response ...
Grid says "No items to display", but the request and response look fine. ... to be perfectly good JSON, the grid remains empty...
Read more >
Display message when data grid (!!) is empty - Mendix Forum
Display message when data grid (!!) is empty ... Consider upgrading to Datagrid 2. It has empty state functionality out-of-the-box. You can find ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found