Hi
Is there any way that I can display some text like 'No items found' or something inside the grid when no items are rendered?
Thanks in advance.
Christoff
Hi Christoff,
sure. This is one way:
rendered: function (event, args) {
if (args.owner.dataSource.dataView().length === 0) {
if (args.owner.element.parent().find(".iggrid-empty").length === 0) {
args.owner.element.parent().prepend("<div class='iggrid-empty'></div>");
}
args.owner.element.parent().find(".iggrid-empty").text("No rows present");
If you want you can also bind to the rendered event outside of the grid initialization code (before you define it):
$("#gridID").live("iggridrendered", function (sender, args) { ... } );
hope it helps. Thanks,
Angel
Hi Angel,
Thanks that did the trick, although a built-in feature would be great :), I ended up using the folllowing code:
rendered: function (event, args) { if (args.owner.dataSource.dataView().length === 0) { if (args.owner.element.parent().find(".iggrid-empty").length === 0) { args.owner.element.parent().prepend("<div class='iggrid-empty'></div>"); args.owner.element.parent().find(".ui-iggrid-table, .ui-iggrid-footer").hide(); } args.owner.element.parent().find(".iggrid-empty").append( $("<div class='ui-priority-primary'>( No items could be found )</div>")); } },
Thanks