Custom HTML Widget

Last published at: April 6th, 2021

This sample will illustrate how to write a new dashboard html widget, how to configure it using the Configuration Manager, add the widget in a dashboard designer and then have the widget displaying in the dashboard.

 

 


Start Microsoft Visual Studio 2015 and select “New Project”.   Select “C#” as the language and select “Class Library” as the project type.  This example is going to use C# as the development language.  This same example can be also written using Visual Basic .Net.

For the name of the project, provide “TestCustomHtmlWidget”.

 

Once the project is created, select “Class1.cs” and rename the class to “clsTestHtmlWidget.cs”

 

 

Right click References under TestCustomHtmlWidget Project. Click Add Reference…

 

Reference manager window will open. Click browse button.

Add a reference to FlowWright, navigate to the following directory “C:\inetpub\wwwroot\cDevWorkflow\bin”.  Select the file “cDevDecisionEngine.dll”.

 

Add a using statement : cDevWorkflow.cDevDecisoinEngine

 

 

 

Let’s start building the class, first implement the interface called: “deHtmlWidget”.  In order to implement the interface, we have to implement the “getData” method. The getData method is going to return clsHTMLWidgetReturn object. clsHTMLWidgetReturn has outputHTML property which contains the actual HTML to display in the browser.

 

Add the widgetData attribute above the “clsTestHtmlwidget” class. The attribute accepts four parameters. The first parameter will be the widget name. Second parameter accepts the widget description. Third parameter will be the widget category. Fourth parameter is the widget display name.

 

Using widgetData attribute, we could automatically configure the widget in the configuration manager.

Navigate to the directory where the DLL was compiled to and select the DLL: “TestCustomHtmlWidget.dll”.  Right click on the file and select “Copy” from the context menu.

Copy the widget dll to the following directory: “C:\inetpub\wwwroot\cDevWorkflow\bin”.

Navigate to the dashboard widget on the menu.

 

Let’s configure the new widget using the auto detect feature in FlowWright.

 

Select the widget from the list, and select “ManageConfigure”.

 

Now that the widget is fully configured, let us add the new widget in a dashboard. Go to Manage Dashboards.  Create a new dashboard called “TestCustomWidgetDashboard”. Enter the new dashboard name, select the layout and click the “Create” button to create the dashboard.

 

Once the new dashboard is created, it should render within the dashboard designer:

 

Drag the “User Count” widget from the side toolbar and drop it to the placeholder in the right pane. Click save and preview the dashboard.

Click the “Preview” icon on the widget to preview the html widget: