Problems reloading Dashboard using foreach and DashboardLayoutPanel tag

I changed my code, for adding panels, from using AddPanel to a foreach loop with DashboardLayoutPanel tags as advised in the 18.4.0.30 release notes. The Dashboard and panels load fine initially but if I change the collection used in the foreach loop to a different one then the panels are created empty without any header or content. Any breakpoints I put inside the  DashboardLayoutPanel  tags are never hit (they are on the initial load). The original code using AddPanel worked fine.

My razor mark up is:

        <div style="margin-left: 10px; margin-right: 10px; margin-top: 10px;">
            @if (this.DashBoardObj != null)
            {
                <SfDashboardLayout AllowDragging=@true AllowResizing=@true Columns="10" @[email protected]>
                    <DashboardLayoutEvents Changed=@DashBoardTilePositionChange OnResizeStop=@DashBoardTileSizeChange />
                    <DashboardLayoutPanels>
                        @foreach (DashBoardTile DashBoardTileObj in this.DashBoardObj.Tiles)
                        {
                            <DashboardLayoutPanel [email protected]()
                                                  [email protected]
                                                  [email protected]
                                                  [email protected]
                                                  [email protected]
                                                  @key=@DashBoardTileObj>
                                <HeaderTemplate>
                                    @{ var Scope = this.DashBoardObj.Scopes.Where(x => x.DashBoardScopeId == DashBoardTileObj.ScopeId).FirstOrDefault();
                                        var ScopeName = "Not found";
                                        if (Scope != null)
                                        {
                                            ScopeName = Scope.Name;
                                        }
                                        <DashBoardTileHeader DashBoardTileObj=@DashBoardTileObj DashBoardScopeName=@ScopeName OpenTileSettingsCallback=@OpenDashBoardTileSetting DeleteTileCallback=@DeleteDashBoardTile DownloadTileDataCallback=@DownLoadDashBoardTileData></DashBoardTileHeader>
                                    }
                                </HeaderTemplate>
                                <ContentTemplate>
                                    <DashBoardTileContent DashBoardTileObj=@DashBoardTileObj @[email protected]></DashBoardTileContent>
                                </ContentTemplate>
                            </DashboardLayoutPanel>
                        }
                    </DashboardLayoutPanels>
                </SfDashboardLayout>
             }
        </div>

I came across your sample you posted in response to threadId 157743. I've amended it to replicate the reload I'm doing. Clicking the Widget1 and Widget2 buttons will demonstrate the issue. I wasn't sure if I need to call RemoveAllAsync before the reload but these fail also.


@page "/"
@using Syncfusion.Blazor.Layouts
@using Syncfusion.Blazor.Buttons

<SfDashboardLayout Columns="12" AllowResizing="true" @ref=@dashboard>
    <DashboardLayoutPanels>
        @foreach (WidgetData widget in widgets)
        {
                <HeaderTemplate>
                    <p>@widget.Header</p>
                </HeaderTemplate>
                <ContentTemplate>
                    <p>@widget.content</p>
                </ContentTemplate>
            </DashboardLayoutPanel>
        }
    </DashboardLayoutPanels>
</SfDashboardLayout>

<SfButton Content="Load Widget1" OnClick="LoadWidget1"></SfButton>
<SfButton Content="Load Widget2" OnClick="LoadWidget2"></SfButton>
<SfButton Content="Load Widget1 with RemoveAll" OnClick="LoadWidget1RemoveAll"></SfButton>
<SfButton Content="Load Widget2 with RemoveAll" OnClick="LoadWidget2RemoveAll"></SfButton>

@code {

    SfDashboardLayout dashboard;


    static List<WidgetData> widgets1 = new List<WidgetData>
{
                    new WidgetData {ID="lay1", X = 0, Y = 0, Width = 1, Height = 1 , Header="Panel1",  content=@<SfButton Content="Button1"></SfButton>, Color="Red" },
                    new WidgetData {ID="lay2", X = 0, Y = 1, Width = 1, Height = 1 , Header="Panel2", content=@<SfButton Content="Button2"></SfButton>, Color="Yellow"},
                    new WidgetData { ID="lay3",X = 0, Y = 2, Width = 1, Height = 1 , Header="Panel3", content=@<SfButton Content="Button3"></SfButton>, Color="Blue" }
        };

        static List<WidgetData> widgets2 = new List<WidgetData>
                {
                            new WidgetData {ID="lay4", X = 0, Y = 0, Width = 1, Height = 1 , Header="Panel4",  content=@<SfButton Content="Button4"></SfButton>, Color="Red" },
                            new WidgetData {ID="lay5", X = 0, Y = 1, Width = 1, Height = 1 , Header="Panel5", content=@<SfButton Content="Button5"></SfButton>, Color="Yellow"},
                            new WidgetData { ID="lay6",X = 0, Y = 2, Width = 1, Height = 1 , Header="Panel6", content=@<SfButton Content="Button6"></SfButton>, Color="Blue" },
                            new WidgetData { ID="lay7",X = 0, Y = 2, Width = 1, Height = 1 , Header="Panel7", content=@<SfButton Content="Button7"></SfButton>, Color="Green" }
                };

        List<WidgetData> widgets = widgets1;

        public class WidgetData
        {
            public string ID { get; set; }
            public int X { get; set; }
            public int Y { get; set; }
            public int Width { get; set; }
            public int Height { get; set; }
            public RenderFragment content { get; set; }
            public string Header { set; get; }
            public string Color { get; set; }
        }

        public void LoadWidget1()
        {
            widgets = widgets1;
        }

        public void LoadWidget2()
        {
            widgets = widgets2;
        }

        public async Task LoadWidget1RemoveAll()
        {
            await dashboard.RemoveAllAsync();
        widgets = widgets1;
        }

        public async Task LoadWidget2RemoveAll()
        {
            await dashboard.RemoveAllAsync();
            widgets = widgets2;
        }
}

21 Replies

SP Sowmiya Padmanaban Syncfusion Team January 5, 2021 11:19 AM UTC

Hi Michael Aston,  
 
Greetings from Syncfusion support. 
 
We have checked your reported problem with DashboardLayout component. We have already considered this as a feature from our end (replace of entire collection in DashboardLayout). This feature will be included in the Volume 4 sp1 release which is expected to be released by the end of January 2021.  
 
Please track the below feedback for feature status.  
 
We appreciate your patience.      
  
Regards,   
Sowmiya.P  



MA Michael Aston January 25, 2021 10:52 AM UTC

Can you confirm that this fix will ship with SP1 at end of January?

The link in your replay doesn't seem to work.


KR Keerthana Rajendran Syncfusion Team January 26, 2021 10:11 AM UTC

Hi Michael Aston,   
 
Sorry for the inconvenience.  
 
Due to some technical complexities, we were unable to include the fix for replace of entire collection in DashboardLayout component in this Volume 4 SP1 release.    
    
We are currently implementing this feature with high priority. This feature will be included in the Volume 1 release that will be released by the end of March, 2021. You can track the status through the below portal link 
 
 
We appreciate your patience. 
 
Regards, 
Keerthana.  
  



MA Michael Aston February 22, 2021 03:36 PM UTC

Can you confirm that this it still scheduled for end of March?


KR Keerthana Rajendran Syncfusion Team February 23, 2021 06:25 AM UTC

Hi Michael Aston,    
  
Sorry for the inconvenience.   
  
Due to technical complexities, we were unable to include the fix for replace of entire collection in DashboardLayout component in this Volume 1 release.     
     
We are currently implementing this feature with high priority and this will be included in the Volume 1, SP1 release that will be released by the end of April, 2021.  
 
You can track the status through the below portal link  
  
  
We appreciate your patience.  
  
Regards,  
Keerthana.   



MA Michael Aston February 23, 2021 11:52 AM UTC

Thanks for the update. We are looking to deliver our app end of June so anything later than end of April will be a problem for us.


KR Keerthana Rajendran Syncfusion Team February 24, 2021 12:35 PM UTC

Hi Michael, 
 
Sorry for the inconvenience. We have already considered this as priority and will include this in our SP1 release by the end of April 2021 as informed earlier. You can track the status through the provided feedback link. 
 
Regards, 
Keerthana. 
 



MA Michael Aston April 27, 2021 10:33 AM UTC

Is this fix still scheduled for end of April? Feedback link is now showing it scheduled for June


KR Keerthana Rajendran Syncfusion Team April 28, 2021 09:30 AM UTC

Hi Michael, 
 
Sorry for the inconvenience.  
 
Due to some high priority features, this is postponed to Volume 2 release which is expected to be rolled out by the month of June, 2021 . We request you to track the feedback for the status of this feature implementation. 
 
Regards, 
Keerthana. 



MA Michael Aston April 28, 2021 09:42 AM UTC

This is pretty poor. History of this issue:


5th Jan - Promised a fix would be delivered Vol4 Sp1
26th Jan - Moved to Vol1
23rd Feb - Moved to Vol1 Sp1
5th Apr - Moved to Vol2

What is going on! 
How can we have confidence that you will fix it in Vol2


KR Keerthana Rajendran Syncfusion Team April 29, 2021 01:06 PM UTC

Hi Michael,  
 
We deeply regret for the inconvenience.  
 
We were in the process of standardizing our Blazor components and this took more time than expected. We will implement this in Volume 2 release without further delay. 
 
Regards, 
Keerthana.  



MA Michael Aston July 4, 2021 10:49 AM UTC

Has this been implemented in Vol 2 as promised?



MA Michael Aston July 4, 2021 04:00 PM UTC

Ok I see from the release notes for 19.2.44 that 

  • #I329615 - The issue with “The AddPanel method is not working when using for loop” has been resolved
has been implemented and I've verified that it is now possible to add to the Tile collection bound to the dashboard and have the new Tile rendered. 

BUT removing a tile from the collection still does not work nor does the clearing of the collection.


MA Michael Aston July 5, 2021 08:22 AM UTC

Spoke too soon. Add doesn't seem to work if there are tiles already in the collection.


In summary, what I'm expecting is to be able to add and remove tiles from the collection bound to the dashboard and for it to update the dashboard visuals. Calling a refresh method to have the dashboard revaluate the collection would be fine.



SS Sharon Sanchez Selvaraj Syncfusion Team July 5, 2021 12:38 PM UTC

Hi Michael, 
 
Sorry for the inconvenience. 
 
We have provided support for adding panels to the collection. However, we are still facing few issues while removing the panels bound to the collection. We will fix these issues and provide an update on or before Volume 3 release. You can check our last shared feedback for tracking this feature status. 
 
We appreciate your patience. 
 
Regards, 
 
Sharon Sanchez S. 



MA Michael Aston August 16, 2021 06:17 PM UTC

Noticed that a fix for this was delivered in 19.2.48. This is a big improvement but there are still a couple of issues:

1) If the tile has a titlebar and uses an SfChart in the content then chart vertical size is incorrect. Note is the tile is added in the initialize this does not happen.

2) Tiles that are add in initialize do not drag if they are deleted and added back.


Attach is a demo project with a video of the issue in the root.


Attachment: DashboardlayoutTest_70a68a81.zip


SS Sharon Sanchez Selvaraj Syncfusion Team August 17, 2021 02:23 PM UTC

Hi Michael, 
 
Query 1: If the tile has a titlebar and uses an SfChart in the content then chart vertical size is incorrect. Note is the tile is added in the initialize this does not happen. 
 
We were able to replicate the issue and we are validating on this. We will update you further details within two business days by August 19th 2021. 
 
Query 2: Tiles that are add in initialize do not drag if they are deleted and added back. 
 
We have checked with your reported gif and sample attachments.  
 
To overcome this scenario, we suggest you to add the following code. 
 
  // Process dashboard toolbar buttons 
        protected async Task ToolbarClick(Syncfusion.Blazor.Navigations.ClickEventArgs args) 
        { 
            switch (args.Item.Id) 
            { 
                case "NewTile": 
                    int NewId; 
                    if (DashBoardObj.Tiles.Count > 0) 
                        NewId = DashBoardObj.Tiles.Max(x => x.DashBoardTileId)+1; 
                    else 
                        NewId = 1; 
 
                    Point pt = await GetTilePlacement(12, 12); 
                    DashBoardObj.Tiles.Add(new DashBoardTile { DashBoardTileId = NewId, SizeX = 12, SizeY = 12, PositionX = pt.X, PositionY = pt.Y}); 
                    break; 
 
                case "DeleteTile": 
                    var Tile = DashBoardObj.Tiles.Last(); 
                    DashBoardObj.Tiles.Remove(Tile); 
                    break; 
 
                case "NewDashBoard": 
                    DashBoards.Add(new DashBoard { DashBoardId = 2, Name = "Test2" }); 
                   DashBoardId = 2; 
                    break; 
            } 
            await MainDashboard.RefreshAsync(); 
        } 
 
Please get back to us if you need any further assistance. 
 
Regards, 
 
Sharon Sanchez S.


SS Sharon Sanchez Selvaraj Syncfusion Team August 19, 2021 03:37 PM UTC

Hi Michael, 
  
 
Sorry for the inconvenience. Since we are facing few complexities regarding the first query, we need additional time to validate this in our end. We will provide you further details within three business days, by August 24th 2021. 
  
 
Regards, 
 
Sharon Sanchez S. 



SS Sharon Sanchez Selvaraj Syncfusion Team August 24, 2021 04:33 PM UTC

Hi Michael,

Sorry for the inconvenience.

We were able to replicate the mentioned issue and have considered it as a bug from our end. The fix for this issue will be included in our third weekly patch release, by the month of September.

Please track the below feedback link to know the status of the issue.


Please get back to us if you need any further assistance.

Regards,
Sharon Sanchez S.




MA Michael Aston June 14, 2022 10:56 AM UTC

Hi,

Noticed that 28164, although marked as complete, is still effecting the Circular gauge chart. Other chart types seem fine.





PM Prasanth Madhaiyan Syncfusion Team June 16, 2022 01:13 PM UTC

Hi Michael,


We have validated your query in the latest package version, but we were unable to reproduce the reported issue at our end. For your reference, we have attached the sample in the latest version (V20.1.0.60) and a video footage.


Sample : https://www.syncfusion.com/downloads/support/directtrac/general/ze/Dashboard14389671301-410215752.zip


Video : https://www.syncfusion.com/downloads/support/directtrac/general/ze/DashboardVideo-791610949.zip


Kindly check the shared sample at your end. If the issue still persist, share with us the package version used in your sample. Please share the details with us, which will help us to check and provide a prompt solution. Let us know if you need any further assistance.


Regards,

Prasanth Madhaiyan.


Loader.
Up arrow icon