DashboardLayout panels with option "close".

Hi, 

    I see that exist one option to resize each panel of dashboard layout. 

    It's possible to drag and drop each panel too.

    But : Is there any option to close the panel ?.

 Thanks in advance !.

 Jorge


1 Reply

KR Keerthana Rajendran Syncfusion Team August 2, 2021 05:17 AM UTC

Hi Jorge, 
 
Thanks for contacting Syncfusion support. 
 
We checked your requirement to close the panel of Dashboard Layout. You can add a close icon for each panel and perform remove action by using removePanel method.  
 
Refer to the following code. 
 
<DashboardLayoutComponent id="default_dashboard" columns={5} ref={(scope) => { this.dashboardObj = scope; }} cellSpacing={this.cellSpacing} allowResizing={true}> 
                        <div id="one" className="e-panel" data-row="0" data-col="0" data-sizeX="1" data-sizeY="1"> 
                            <span id="close" className="e-close-icon e-clear-icon"/> 
                            <div className="e-panel-container"> 
                                <div className="text-align">0</div> 
                            </div> 
                        </div> 
             .  .  .  .  .  .  . . . 
                    </DashboardLayoutComponent> 
 
onCloseIconHandler(event) { 
    let proxy = this; 
    let panel = event.target; 
    if (panel.offsetParent) { 
      proxy.dashboardObj.removePanel(panel.offsetParent.id); 
    } 
  } 
  rendereComplete() { 
    let closeElement = document.querySelectorAll('.e-clear-icon'); 
    for (let i = 0; i < closeElement.length; i++) { 
      closeElement[i].addEventListener( 
        'click', 
        this.onCloseIconHandler.bind(this) 
      ); 
    } 
  } 
 
 
Refer to the following UG and demo links for more details on Dashboard Layout component. 
 
 
 
Please get back to us if you need further assistance.  
 
Regards, 
Keerthana. 
 


Loader.
Up arrow icon