I have a view using the table format. In the table settings I have "Show the empty text in the table" checked. I also added a Global:text area in the Header of the view. It contains a "hard-coded" link to add a particular type of entity. In the header settings, I have the "Display even if view has no result" checked.

Despite these two settings, if there is no content in the table, the view does not get rendered nor does my link from the views header. Is there are way to show the empty view so the "add [content]" link shows or is there another way to add the link?

Thanks,
Mickey

Comments

mkadin’s picture

Category: bug » support

Mickey, EVA should still display the view. I've just tested it on a local dev environment for me and it showed up just fine. Have you successfully gotten the view to show up when there are results? Perhaps that's the issue, and not the no results behavior.

micnap’s picture

Hi,

Yes, the view shows fine where there is content to display. It is used on a custom entity type created by a third party module (Redhen) though, and not a standard node, if that makes any difference. I've just discovered hook_menu_local_tasks_alter, however. I'm thinking that may be the better way to go in this instance rather than hard-coding the link.

Thank you for the quick response!

Mickey

mkadin’s picture

Category: support » bug

Well that does sound like a bug then...It could be related to the custom entity, but if it is successfully attaching when there is content then it'd be weird to only show up when there's no view results.

If you want to help me track it down, maybe you could spend a few minutes dsm()'ing inside eva_entity_view_alter() in eva.module. I'd be interested to see the results of calls to _eva_extract_entity_from_build($build), eva_get_views($type), and $view->execute_display($info['display']).

micnap’s picture

Well, the local_tasks_alter didn't work out so well, so I'm back to this.

I traced it all the way down to the eva_plugin_display_entity class. In the execute() function, the three eva views I have on the site ARE being rendered. But $data isn't being returned because none of the conditions in this:

if (!empty($this->view->result) || $this->get_option('empty') || !empty($this->view->style_plugin->definition['even empty'])) {

is true. I'll trace it further tomorrow.

Thanks,
Mickey

micnap’s picture

Status: Active » Closed (works as designed)

The trick to getting the view to show is to use the No Results Behavior settings under the Advanced section in the view, NOT the No Results Behavior setting under an individual field in a view.

Fixed.

Dupal - 9,345 : Mickey - 0

[banging head on desk]

windmaomao’s picture

i found a even better way, add a custom text field to he No Results Behavior, and then add a space there just to trigger view display.

then you can use header or footer as used to be.

annie2512’s picture

Issue summary: View changes

#5 resolved my issue. Now when view has no results, it display the content in No Results Behavior settings under the Advanced section. Thanks @micnap