Deleting the detailPanel based on a specific condition leads to extra padding

Hello everyone, I am currently working on adding a detailPanel based on a certain condition. However, when I hide it, there is an empty space left behind as shown in this link.

The code works perfectly fine when the detail panel is provided:

get rowDetailsPanel() {
const { detailPanel, classes } = this.props;
// @Workarround To Hide Details Panel In Case There is No Details Panels Provided
return [
  {
    tooltip: 'Show Name',
    disabled: !detailPanel,
    icon: () => <ChevronRightIcon className={!detailPanel && classes.displayNone}/>,
    render: rowData => detailPanel(rowData)
  },
];

}

For a functional detailPanel, you can refer to this link.

In essence, I am attempting to completely remove the column when the detailPanel is hidden. Any tips or insights would be greatly appreciated.

Answer №1

Here is a solution that should do the trick:

get rowDetailsPanel() {
const { detailPanel, classes } = this.props;
// @Temporary Fix to Hide Details Panel When No Panels Are Provided
return detailPanel ? [
  {
    tooltip: 'Show Name',
    disabled: !detailPanel,
    icon: () => <ChevronRightIcon className={!detailPanel && classes.displayNone}/>,
    render: rowData => detailPanel(rowData)
  },
] : undefined;

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Having trouble applying CSS to SVG icons from defs file in Webkit Browser

I've been tinkering with a project that incorporates SVG icons, hoping to style them using CSS for various scenarios and hover effects. However, my attempts are falling short in Webkit, while Firefox is displaying the icons as intended: http://codepe ...

Troubleshooting Issue with Custom Styling in React MUI: Selected Tab Styling Override

I am working on a project using React Material UI version 3. Within one of my components, I want to customize the appearance of the selected tab by changing the border-bottom style compared to the other tabs. Initially, I tried applying custom styles at th ...

Utilizing HTML5 elements within CSS selector chains

Check out a live example here Modernizr has been successfully implemented; article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section { display: block; } However, the styles are not rendering in IE8 and below even though t ...

Spinning Earth orbits around the Sun

My goal is to create a 3D Solar system, starting with the Sun and Earth using THREE.SphereGeometry() var sphere2 = new THREE.Mesh(new THREE.SphereGeometry(50, 100, 100), new THREE.MeshBasicMaterial({side: THREE.DoubleSide, map:txt2})); sphere2.position.se ...

The grid layout in Bootstrap 4 does not seem to be compatible with dompdf

I am in the process of using dompdf for rendering a PDF file. Our application is built on Bootstrap 4 framework, and I want to incorporate it into the twig template used for generating our documents. However, I have encountered an issue with the Bootstrap ...

Displaying a popup containing a div when clicking on a link

I need assistance with creating a link that will display a div in a popup window. Here is the link I am working with: <li><a class="newAttachmentType" onclick="getFiles(true)">Move to somewhere</a></li> Also, here is the div that ...

Load a variety of tiles to create a unique style and background for the

Currently, I am using this function to randomly retrieve an image. <script> window.onload = choosePic; var myPix = new Array( "https://ry3yr.github.io/OSTR/Diarykeepers_Homepage/extrafiles/images/bgfiles/cool_stuff_anim.gif", "https:// ...

CSS property that determines where a string can be broken into lines based on specific characters

Is it possible to specify characters on which a long string, such as a URL, should break in browsers? For instance: https://www.this-is-my-url.org/upload_dir/2015/01/foo_bar_faq.pdf If the box only allows 40 characters per line, it might break like this ...

Duplicate the form field and add a button beneath the newly generated elements

Clicking the "Add New" button below will add new fields to the form. While everything is functioning properly, I would like the newly created fields to appear above the button instead of below it. How can this be achieved? (function($) { "use strict" ...

Struggling to align materialUI input or textfield horizontally

import {Input} from 'material-ui'; import Select from 'react-select'; I've been trying different ways to adjust the margins and padding, even wrapping them in divs, but I can't seem to get Material UI textfield or input alig ...

What causes the content of a sticky navbar to overflow?

I have a situation where my navbar has two styles (.navbar and .navbar_fixed), but the links in the navbar are not fitting properly. I attempted to remove padding and add left: 0;, however, these adjustments did not work as expected. Any suggestions on how ...

The issue with the min attribute for number inputs not functioning properly when using decimal

When inputting the value 3 in the field and clicking on submit in the HTML snippet below, Chrome displays an error message stating: Please enter a valid value. The two nearest valid values are 2.0001 and 3.0001. This is confusing because I have set the mi ...

Tips for customizing the appearance of a label when a MUI Radio Button is selected

Hello everyone, I am attempting to customize the label text color of a radio button to turn blue when selected. https://i.stack.imgur.com/btSc2.jpg HERE IS THE CODE FOR MY MUI BUTTON SO FAR import * as React from "react"; import Radio from &quo ...

Substitute all web links contained within the DIV

Is there a way to change the URLs within a specific DIV? Here's an example of what I want to do: <div id="SearchList"> <a href="www.google.com/up">up</a> <a href="www.google.com/down">down</a> <a href="www.google.com/ ...

How to center an HTML header

Currently working on a one-page scrollable website, aiming to have the first page consist of a navbar, image, and header. The challenge I'm facing is centered around aligning the header vertically. Although I managed to center it horizontally, the ver ...

A guide on personalizing HTML for Django forms

I have implemented an HTML template on my website and need to capture information for my Django backend. Specifically, I am trying to extract the email address from this section of code: <input type="text" placeholder="Email" value="" style="height: 30 ...

What is the correct way to adjust the style.top attribute of an element using JavaScript?

In order to correct a JavaScript source code, I need to adjust the style.top property of a div element based on an integer parameter from a function called index. Here is the current implementation: div.style.top = (index * 22 + 2)+"px"; However, for lar ...

How to retrieve data from a form object sent via cloud function using App Script

Currently, I am in the process of developing a web application that can extract files from a web form and store them in a designated Google Drive folder. After the user submits the form, my goal is to trigger a cloud function using google.script.run while ...

Any tips for creating a website with non-redirecting tabs?

I'm currently working on a website project and I would like to incorporate tabs on the side of my site for easy navigation. I envision an interactive tab system where users can click on their desired category and be directed there instantly, rather th ...

Getting rid of the outline on <html> while tabbing in Firefox

An odd outline keeps appearing as I tab through elements on a website, but only in Firefox and not in Chrome, Safari, or Opera. To identify the element causing the focus, I used Firebug console by typing: document.activeElement. It showed: >>> d ...