Is it possible to hide a panel without removing it ?

Hi, 

I'd like to remove a panel in the dashboard (and this is very fine using your examples with a button in the corner of each panel).

But is there the possibility, by javascript code, to add again the same panel to the dashboard only with a statement without having to recreate it? 

I'm asking you if there is the possibility to set something like a "visible" property without removing the panel.

Thank you in advance.


1 Reply

IL Indhumathy Loganathan Syncfusion Team August 21, 2023 02:06 PM UTC

Hi Silvio,


Greetings from Syncfusion support.


We have reviewed your query and understand that you are looking for options to hide and show panels in the Dashboard Layout component. We would like to inform you that currently, the Dashboard Layout component does not have built-in functions for hiding and showing panels. However, we have achieved your requirement with a workaround. Depending on the capabilities of the Syncfusion Dashboard Layout, you might be able to achieve a "hidden" effect by applying custom CSS and styling to the panel. Check out the below code snippet.


document.getElementById('restore').onclick = () => {

  //Get the elements.

  var elements = document.querySelectorAll("[hidden='true']");

  for (var i = 0; i < elements.length; i++) {

    //Show the hidden panels.

    elements[i].removeAttribute('hidden');

  }

};

function onCloseIconHandler(event: any): void {

  if ((<HTMLElement>event.target).offsetParent) {

    //Hide the panel.

    document

      .getElementById((<HTMLElement>event.target).offsetParent.id)

      .setAttribute('hidden', 'true');

  }

}


Sample: https://stackblitz.com/edit/3frtgr?file=index.ts


Check out the shared sample and get back to us if you need any further assistance.


Regards,

Indhumathy L


Loader.
Up arrow icon