@foreach (var dashboard in Dashboard)
{
<div>@dashboard.Name</div>
<EjsDashboardLayout @ref="dashboardObject" Columns="5" AllowResizing="true">
<ChildContent>
@{
var SimplePanels = new List<SimplePanelDefinition>
{
new SimplePanelDefinition { X = 0, Y = 0, Width = 4, Height = 3 , Header="Panel1", content=@<EjsButton Content="Button"></EjsButton> },
new SimplePanelDefinition { X = 4, Y = 0, Width = 1, Height = 1 , Header="Panel2", content=@<EjsButton Content="Button1"></EjsButton>},
new SimplePanelDefinition { X = 4, Y = 1, Width = 1, Height = 2 , Header="Panel3", content=@<EjsButton Content="Button2"></EjsButton> }
};
}
@foreach (var panel in SimplePanels)
{
<div class="e-panel" data-row=@panel.X.ToString() data-col=@panel.Y.ToString() data-sizeX=@panel.Width.ToString() data-sizeY=@panel.Width.ToString()>
<div class="e-panel-header">
<div class="text-align">@panel.Header</div>
</div>
<div class="e-panel-content">
@panel.content
</div>
</div>
}
</ChildContent>
</EjsDashboardLayout>
} |
@{
var Dashboard = new List<Dashboards> {
new Dashboards { Name ="dashboard1" }
};
var SimplePanels = new List<SimplePanelDefinition> {
new SimplePanelDefinition { X = 0, Y = 0, Width = 4, Height = 3 , Header="Panel1", content=@<EjsButton Content="Button"></EjsButton> },
new SimplePanelDefinition { X = 4, Y = 0, Width = 1, Height = 1 , Header="Panel2", content=@<EjsButton Content="Button1"></EjsButton>},
new SimplePanelDefinition { X = 4, Y = 1, Width = 1, Height = 2 , Header="Panel3", content=@<EjsButton Content="Button2"></EjsButton> }
};
}
@foreach (var dashboard in Dashboard)
{
<div>@dashboard.Name</div>
<EjsDashboardLayout @ref="dashboardObject" Columns="5" AllowResizing="true">
<DashboardLayoutPanels>
@foreach (var panel in SimplePanels)
{
<DashboardLayoutPanel SizeX="@panel.Width" SizeY="@panel.Height" Col="@panel.X" Row="@panel.Y">
<HeaderTemplate>@panel.Header</HeaderTemplate>
<ContentTemplate>@panel.content</ContentTemplate>
</DashboardLayoutPanel>
}
</DashboardLayoutPanels>
</EjsDashboardLayout>
}
@code {
EjsDashboardLayout dashboardObject;
public class SimplePanelDefinition
{
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 class Dashboards
{
public string Name { get; set; }
}
} |
<SfDashboardLayout Columns="4" AllowResizing="true">
<DashboardLayoutPanels>
@foreach (var panel in SimplePanels)
{
<DashboardLayoutPanel Id=@(panel.ID +""+ dashboard.Name) SizeX= "@panel.Width" SizeY="@panel.Height" Col="@panel.X" Row="@panel.Y">
<HeaderTemplate>
<div style="background-color: @panel.Color; height: 100%; width: 100%; ">
@panel.Header
</div>
</HeaderTemplate>
<ContentTemplate>
<div class="content" style="background-color: @panel.Color; height: 98%; width: 100%; ">
@panel.content
</div>
</ContentTemplate>
</DashboardLayoutPanel>
}
</DashboardLayoutPanels>
</SfDashboardLayout> |