@page "/GridEditTemplat"
@using Syncfusion.EJ2.Blazor.Grids
Lockup when OnActionComplete is used
Reorder the columns and the UI will lock up. If you remove the ActionCompletedHandler it works fine.
@{
var v = (context as Vendor);
var prop = GetProperty(context, "Ticker", v.Name);
@prop.Value
}
@{
var v = (context as Vendor);
var prop = GetProperty(context, "Ticker", v.Name);
}
@code{
@using System.Collections.Generic;
@using System.Collections.ObjectModel;
public ObservableCollection gridData { get; set; }
public Vendor vendorModel = new Vendor();
protected override void OnInitialized()
{
gridData = Vendor.GetAllRecords();
}
protected VendorProperty GetProperty(object context, string property, string name)
{
Vendor v = context as Vendor;
v = gridData.Where(ven => ven.Name == name).FirstOrDefault();
try
{
VendorProperty prop = v.Properties.Where(p => p.Name == property).FirstOrDefault();
return prop;
}
catch (Exception ex)
{
return new VendorProperty("Error", ex.ToString());
}
}
public void ActionCompletedHandler(ActionEventArgs args)
{
}
public class Vendor
{
private List properties = new List ();
public string Id { get; set; }
public string Name { get; set; }
public List Properties { get { return this.properties; } set { this.properties = value; } }
public Vendor()
{
Id = Guid.NewGuid().ToString();
}
public static ObservableCollection GetAllRecords()
{
ObservableCollection ret = new ObservableCollection();
Vendor v = new Vendor() { Name = "Google" };
v.Properties.Add(new VendorProperty("Ticker", "GOOGL"));
v.Properties.Add(new VendorProperty("Status", "Active"));
ret.Add(v);
v = new Vendor() { Name = "Amazon" };
v.Properties.Add(new VendorProperty("Ticker", "AMZN"));
v.Properties.Add(new VendorProperty("Status", "Inactive"));
ret.Add(v);
v = new Vendor() { Name = "Microsoft" };
v.Properties.Add(new VendorProperty("Ticker", "MSFT"));
v.Properties.Add(new VendorProperty("Status", "Active"));
ret.Add(v);
return ret;
}
}
public class VendorProperty
{
private string name;
private string value;
public string Name { get { return this.name; } set { this.name = value; } }
public string Value { get { return this.value; } set { this.value = value; } }
public VendorProperty(string name, string value)
{
Name = name;
Value = value;
}
}
}