Table of Contents

Class GridWidgetBase

Namespace
Dynamicweb.Dashboard.Widgets
Assembly
Dynamicweb.Core.dll

The class DashboardWidget provides base list dashboard widget

public abstract class GridWidgetBase : DashboardWidget, IParameterOptions
Inheritance
GridWidgetBase
Implements
Inherited Members

Examples

using Dynamicweb.Dashboard.Widgets;
using Dynamicweb.Extensibility.AddIns;
using System.Collections.Generic;

namespace Dynamicweb.Dashboard.Examples;

[AddInName("Simple grid")]
[AddInDescription("Total cities population")]
[AddInIcon(Core.UI.Icons.KnownIcon.PieChart)]
public sealed class SimpleGridWidget : GridWidgetBase
{
    public SimpleGridWidget()
    {
        Title = "Total cities population";
    }

    public override IEnumerable<string> GetColumns() => new string[]
    {
        "Name",
        "Population"
    };

    public override List<Dictionary<string, object>> GetItems(IDashboard dashboard, string path) => new()
    {
        new()
        {
            ["Name"] = "London",
            ["Population"] = 500000
        },
        new()
        {
            ["Name"] = "New York",
            ["Population"] = 200000
        },
        new()
        {
            ["Name"] = "Copenhagen",
            ["Population"] = 300000
        },
        new()
        {
            ["Name"] = "Berlin",
            ["Population"] = 200000
        },
        new()
        {
            ["Name"] = "Madrid",
            ["Population"] = 250000
        },
        new()
        {
            ["Name"] = "Pekin",
            ["Population"] = 150000000
        }
    };
}

Constructors

GridWidgetBase()

The list widget default constructor

public GridWidgetBase()

Methods

GetColumns()

Gets grid columns

public abstract IEnumerable<GridWidgetBase.GridWidgetColumn> GetColumns()

Returns

IEnumerable<GridWidgetBase.GridWidgetColumn>

GetItems(IDashboard, string)

Gets grid items

public abstract List<Dictionary<string, object>> GetItems(IDashboard dashboard, string path)

Parameters

dashboard IDashboard

The dashboard

path string

The request path

Returns

List<Dictionary<string, object>>
To top