0

I would like to display the title (and the field titles) of a view even when the view is empty. By default, if a view is empty its title and fields are hidden. How can I force displaying title and fields on an empty view?

I am using views in a panel if that makes a difference.

1 Answer 1

1

Quick and dirty way: make a view that displays just one row, take the source html, edit relevant part of it so that it looks the way you would like to printed when there are no results, ie remove field contents and leave only field titles. Copy and paste that html to No results behaviour -> Global text area.

The view title should always be displayed, right?

4
  • as far i remember views title should be there.
    – arpitr
    Nov 16, 2013 at 21:29
  • Thank you for your answer. It works kindof, but the rendering is not really how it should be. For a proper way of doing it I actually have a tpl.php file for this panel in which I can access $content variable but it is already rendered. I tried also preprocess_panels_pane but again content is already rendered. Any suggestion?
    – Baba
    Nov 17, 2013 at 21:40
  • I have copied the html has you suggested, and included it in my tpl.php file because the No result behaviour would not display the elements correctly. Now it works but I still need to test wether the view is empty. So I have posted a new question here
    – Baba
    Nov 18, 2013 at 1:46
  • Actually adding the html to Global unfiltered text area preserves markup and works.
    – Baba
    Nov 20, 2013 at 20:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.