GridWidget Class |
Namespace: Dynamicweb.Dashboards.Widgets
The GridWidget type exposes the following members.
Name | Description | |
---|---|---|
GridWidget |
The list widget default constructor
|
Name | Description | |
---|---|---|
Columns |
Gets or sets widget size
(Inherited from DashboardWidget.) | |
CreatedDate |
Gets the created date and time.
(Inherited from DashboardWidget.) | |
Element |
The to be shown
(Inherited from DashboardElementWidget.) | |
Id |
Gets widget Id
(Inherited from DashboardWidget.) | |
InstantFetch |
Gets or sets value indicating whether data should be fetch to widget instantly, otherwise - using ajax
| |
ModifiedDate |
Gets the last modified date and time.
(Inherited from DashboardWidget.) | |
OnRowClick |
Gets or sets action for row on click event
| |
Order |
Gets or sets widget order
(Inherited from DashboardWidget.) | |
ShowTitle |
Gets or sets value indicating whether to show widget title.
(Inherited from DashboardWidget.) | |
Title |
Gets or sets widget title
(Inherited from DashboardWidget.) | |
TitleAction |
Gets or sets widget title action
(Inherited from DashboardWidget.) |
Name | Description | |
---|---|---|
Fetch |
Fetches widget with data
(Overrides DashboardWidgetFetch(IDashboard, String).) | |
GetColumns |
Gets grid columns
| |
GetIdSuitableString | (Inherited from ConfigurableAddIn.) | |
GetItems |
Gets grid items
| |
GetOptions |
Return dropdown options
(Inherited from DashboardWidget.) | |
GetParametersToXml | (Inherited from ConfigurableAddIn.) | |
GetParametersToXml(Boolean) | (Inherited from ConfigurableAddIn.) | |
LoadParametersFromXml | (Inherited from ConfigurableAddIn.) | |
Render |
The method render widget and return html
(Inherited from DashboardElementWidget.) | |
RenderAdditionalContent | (Inherited from ConfigurableAddIn.) | |
ScriptDependencies |
Specifies relative paths to all script files that this widget is dependent upon.
(Inherited from DashboardWidget.) | |
SetValue | (Inherited from ConfigurableAddIn.) | |
StylesheetDependencies |
Specifies relative paths to all style files that this widget is dependent upon.
(Inherited from DashboardWidget.) | |
UpdateFromPost | (Inherited from ConfigurableAddIn.) |
using Dynamicweb.Dashboards.Widgets; using Dynamicweb.UI.Elements.Displays; using System.Collections.Generic; using System.IO; using System.Linq; using Dynamicweb.Extensibility.AddIns; using Dynamicweb.Core; namespace Dynamicweb.Dashboards.Examples { [AddInName("Top files folders size")] [AddInDescription("Show files folders sizes")] [AddInIcon(Core.UI.Icons.KnownIcon.Healing)] public class FilesFolderSizes : ListWidget { const string Folder = "/Files"; public FilesFolderSizes() { Title = "Top space-hogging files folders"; } [AddInParameterEditor("", "")] public override int Columns { get { return base.Columns; } set { base.Columns = value; } } public override IEnumerable<ListViewItem> GetItems(IDashboard dashboard, string path) { var filesPath = SystemInformation.MapPath(Folder); var items = from dirPath in Directory.GetDirectories(filesPath) let dirInfo = new DirectoryInfo(dirPath) let dirSize = Helper.DirSize(dirInfo) orderby dirSize descending select new { Name = dirInfo.Name, Size = dirSize }; double count; string subtitle; foreach (var item in items.Take(4)) { Helper.HumanizeByteSize(item.Size, out count, out subtitle); yield return new ListViewItem() { Icon = Core.UI.Icons.KnownIcon.Folder, Title = item.Name, Hint = string.Format("The folder size {0:0.##} {1}", count, subtitle) }; } } } }