Posted on 02/12/2019 13:41:59
Thanks Morten,
Helped me alot. Do you know if it's possible to control the height of the widget element?
I have created a ListWidget but content extends outside the widget container - see attached
[AddInName("Product group list with uplift")]
[AddInDescription("All product groups with uplift/downlift")]
[AddInIcon(Dynamicweb.Core.UI.Icons.KnownIcon.HeartO)]
public class ProductGroupDashboard : ListWidget
{
public ProductGroupDashboard()
{
Title = "Product groups with uplift/downlift";
Columns = 6;
}
public override IEnumerable<ListViewItem> GetItems(IDashboard dashboard, string path)
{
var groupList = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroups();
if (groupList.Any())
{
foreach (var group in groupList)
{
var groupFieldValues = group.ProductGroupFieldValues;
if (groupFieldValues != null)
{
var groupFieldValue = groupFieldValues.GetProductGroupFieldValue("GroupPercentage");
if (groupFieldValue != null && groupFieldValue.HasValue)
{
var upliftPercent = Convert.ToDouble(groupFieldValue.Value);
if (upliftPercent != 0)
{
var data = new ListViewItem()
{
Title = group.Name,
RightText = upliftPercent.ToString() + "%",
OnClick = "location.href = '/Admin/Module/eCom_Catalog/dw7/edit/EcomGroup_Edit.aspx?ID=" + group.IdUrlEncoded + "#'",
};
yield return data;
}
}
}
}
}
}
}