Dashboard layout and side bar

Hi Team,

I am trying to develop a web page having a sidebar and dashboard layout.  My issue is the panels inside the dashboard layout is not auto-adjusting its width when the sidebar is hidden/Shown. 

Attaching the screenshots. Please let me know how can I fix this.

Thanks!








3 Replies

SP Sowmiya Padmanaban Syncfusion Team March 24, 2020 08:54 AM UTC

Hi Darryl,  
 
Greetings from Syncfusion support. 
 
We have checked your reported problem that Dashboard Layout not aligned properly. DashboardLayout does not detect the changes from the Sidebar element. To achieve your requirement , you need  to change the width of the DashboardLayout in Sidebar open and close event.  
 
Refer the below code snippet. 
   onOpen(){ 
      if(!Browser.isDevice) { 
     //290 denotes the sidebar width. 
      let parentElement : HTMLElement = document.getElementById("dashboardParent"); 
      parentElement.style.width = "calc(100% - 290px)" 
      } 
    } 
    onClose(){ 
      if(!Browser.isDevice) { 
      let parentElement : HTMLElement = document.getElementById("dashboardParent"); 
      parentElement.style.width = "100%"; 
      this.dashboard.refresh(); 
      this.refreshContent() 
      } 
    } 

Refer the sample link. 
 
Another way to achieve your requirement , you need to refresh() the DashboardLayout and it’s content element during DashboardLayout created and sidebar Close event. 
 
In that case, DashboardLayout is rendered based on parent element dimension. Refer the below codes snippet
   onClose(){ 
      setTimeout(() =>{ 
       this.dashboard.refresh(); 
       this.refreshContent() 
      },300)   
    } 
    onCreate() { 
      setTimeout(() =>{ 
       this.dashboard.refresh(); 
       this.refreshContent() 
      },300)   
    } 

Refer the sample link. 
 
Refer the below links for DashbboardLayout component. 
 
 
 
 
Please let us know, if you have any concerns. 
 
Regards,  
Sowmiya.P 



DJ Darryl Johnson March 24, 2020 09:39 PM UTC

Thank you..That helps!


SP Sowmiya Padmanaban Syncfusion Team March 25, 2020 04:09 AM UTC

Hi Darryl, 
  
We have happy to hear that the provided solution resolved your issue. Please get back with us if you need any future assistance. 
  
Regards,  
Sowmiya.P 


Loader.
Up arrow icon