Support "Hide if empty" for D8

Created on 4 March 2021, over 3 years ago
Updated 19 May 2023, about 1 year ago

Problem/Motivation

Sometimes it's useful to hide unnecessary rows when they don't have any values for all of the columns. By this way users are not confused with useless empty rows and the user interface is minimal if the table has many rows.

Steps to reproduce

1. Create a View Flipped Table
2. Add Field
3. Enable "Hide if empty" under "No results behavior"
4. View the page. Even if the field is empty then the row is being displayed with empty cells

Proposed resolution

Hide the whole row if "Hide if empty" option is enabled and all the cells of a row are empty. As I can see this functionality was available at D7 version.

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Closed: works as designed

Version

1.4

Component

Code

Created by

🇬🇷Greece dimKarp Athens

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇯🇵Japan jorgemare

    Howdy,

    Sorry to bring this issue back, but I have upgraded the site I am developing to Drupal 10, and even with the same settings ("Hide Empty Column" in the Flipped Table formatter settings, and "Hide if empty" in the field's setting) the empty rows are now shown.

    I have made sure that the cache is flushed, even turned off the cache in the view itself, but the problem persists. Attaching screenshot for reference.

    By the way, there is nothing of interest in the Drupal log.

    Any ideas of what may be causing this?

    Thank you in advance!

  • 🇯🇵Japan jorgemare

    Howdy,

    After updating Drupal to version 10.0.9, now I am seeing the following error message in the log every time I load a page with a flipped table view.

    Warning: Drupal\views\Plugin\ViewsHandlerManager->getHandler() 内 Undefined array key "id" (/var/www/html/web/core/modules/views/src/Plugin/ViewsHandlerManager.php の 104 行目)
    #0 /var/www/html/web/core/includes/bootstrap.inc(158): _drupal_error_handler_real()
    #1 /var/www/html/web/core/modules/views/src/Plugin/ViewsHandlerManager.php(104): _drupal_error_handler()
    #2 /var/www/html/web/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php(898): Drupal\views\Plugin\ViewsHandlerManager->getHandler()
    #3 /var/www/html/web/core/modules/views/src/ViewExecutable.php(1055): Drupal\views\Plugin\views\display\DisplayPluginBase->getHandlers()
    #4 /var/www/html/web/core/modules/views/src/ViewExecutable.php(913): Drupal\views\ViewExecutable->_initHandler()
    #5 /var/www/html/web/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php(2328): Drupal\views\ViewExecutable->initHandlers()
    #6 /var/www/html/web/core/modules/views/src/ViewExecutable.php(1707): Drupal\views\Plugin\views\display\DisplayPluginBase->preExecute()
    #7 /var/www/html/web/core/modules/views/src/ViewExecutable.php(1642): Drupal\views\ViewExecutable->preExecute()
    #8 /var/www/html/web/core/modules/views/src/Element/View.php(81): Drupal\views\ViewExecutable->executeDisplay()
    #9 /var/www/html/web/core/modules/views/src/Plugin/Block/ViewsBlock.php(59): Drupal\views\Element\View::preRenderViewElement()
    #10 /var/www/html/web/core/modules/block/src/BlockViewBuilder.php(171): Drupal\views\Plugin\Block\ViewsBlock->build()
    #11 [internal function]: Drupal\block\BlockViewBuilder::preRender()
    #12 /var/www/html/web/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(101): call_user_func_array()
    #13 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(788): Drupal\Core\Render\Renderer->doTrustedCallback()
    #14 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(374): Drupal\Core\Render\Renderer->doCallback()
    #15 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(446): Drupal\Core\Render\Renderer->doRender()
    #16 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(204): Drupal\Core\Render\Renderer->doRender()
    #17 /var/www/html/web/core/lib/Drupal/Core/Template/TwigExtension.php(477): Drupal\Core\Render\Renderer->render()
    #18 /var/www/html/web/sites/default/files/php/twig/6466be4b1ebc9_page--components_manufact_T0Ace7Zkaf5L0NKUCfYUqp3Zt/kxKrdOEsTg6kOn5cPGHLnnVYaGb_H_hVTaBo4F3H8fE.php(472): Drupal\Core\Template\TwigExtension->escapeFilter()
    #19 /var/www/html/vendor/twig/twig/src/Template.php(171): __TwigTemplate_bc1f41ca18894907eeb05d98e2dc92ec->block_content()
    #20 /var/www/html/web/sites/default/files/php/twig/6466be4b1ebc9_page--components_manufact_T0Ace7Zkaf5L0NKUCfYUqp3Zt/kxKrdOEsTg6kOn5cPGHLnnVYaGb_H_hVTaBo4F3H8fE.php(367): Twig\Template->displayBlock()
    #21 /var/www/html/vendor/twig/twig/src/Template.php(171): __TwigTemplate_bc1f41ca18894907eeb05d98e2dc92ec->block_main()
    #22 /var/www/html/web/sites/default/files/php/twig/6466be4b1ebc9_page--components_manufact_T0Ace7Zkaf5L0NKUCfYUqp3Zt/kxKrdOEsTg6kOn5cPGHLnnVYaGb_H_hVTaBo4F3H8fE.php(110): Twig\Template->displayBlock()
    #23 /var/www/html/vendor/twig/twig/src/Template.php(394): __TwigTemplate_bc1f41ca18894907eeb05d98e2dc92ec->doDisplay()
    #24 /var/www/html/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling()
    #25 /var/www/html/vendor/twig/twig/src/Template.php(379): Twig\Template->display()
    #26 /var/www/html/vendor/twig/twig/src/TemplateWrapper.php(40): Twig\Template->render()
    #27 /var/www/html/web/core/themes/engines/twig/twig.engine(53): Twig\TemplateWrapper->render()
    #28 /var/www/html/web/core/lib/Drupal/Core/Theme/ThemeManager.php(372): twig_render_template()
    #29 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(433): Drupal\Core\Theme\ThemeManager->render()
    #30 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(204): Drupal\Core\Render\Renderer->doRender()
    #31 /var/www/html/web/core/lib/Drupal/Core/Template/TwigExtension.php(477): Drupal\Core\Render\Renderer->render()
    #32 /var/www/html/web/sites/default/files/php/twig/6466be4b1ebc9_html.html.twig_Ka2CKnUuRjIWvq8m1_Z34FfnV/STr8220A83s7AN-wFG46ESNJfH0O-I-RtGhaxdhf55o.php(86): Drupal\Core\Template\TwigExtension->escapeFilter()
    #33 /var/www/html/vendor/twig/twig/src/Template.php(394): __TwigTemplate_4c4cef7beb6adcb805587690c974adbd->doDisplay()
    #34 /var/www/html/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling()
    #35 /var/www/html/vendor/twig/twig/src/Template.php(379): Twig\Template->display()
    #36 /var/www/html/vendor/twig/twig/src/TemplateWrapper.php(40): Twig\Template->render()
    #37 /var/www/html/web/core/themes/engines/twig/twig.engine(53): Twig\TemplateWrapper->render()
    #38 /var/www/html/web/core/lib/Drupal/Core/Theme/ThemeManager.php(372): twig_render_template()
    #39 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(433): Drupal\Core\Theme\ThemeManager->render()
    #40 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(204): Drupal\Core\Render\Renderer->doRender()
    #41 /var/www/html/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(158): Drupal\Core\Render\Renderer->render()
    #42 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}()
    #43 /var/www/html/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(159): Drupal\Core\Render\Renderer->executeInRenderContext()
    #44 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse()
    #45 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
    #46 /var/www/html/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func()
    #47 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(168): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
    #48 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(74): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
    #49 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle()
    #50 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
    #51 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
    #52 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
    #53 /var/www/html/web/core/modules/ban/src/BanMiddleware.php(50): Drupal\page_cache\StackMiddleware\PageCache->handle()
    #54 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\ban\BanMiddleware->handle()
    #55 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
    #56 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
    #57 /var/www/html/web/core/lib/Drupal/Core/DrupalKernel.php(686): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
    #58 /var/www/html/web/index.php(19): Drupal\Core\DrupalKernel->handle()
    #59 {main}

    Should I file a separate bug report?

  • 🇯🇵Japan jorgemare

    Howdy,

    Please ignore messages #11 and #12.

    It turns out the problem was being caused by the twig debug mode which was on (true). If I turn off the twig debug mode, all is well.

    Sorry for the noise!

Production build 0.69.0 2024