If I use the
RowDeselected event of grid control, in blazor client side project, it throws the error:
Uncaught (in promise) Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: [. Path 'rowIndex', line 1, position 13.
@page "/testgrid"
TestGrid
@code{
EjsGrid DefaultGrid;
public int GridHeight;
public List Orders { get; set; }
protected override void OnInit()
{
Orders = Enumerable.Range(1, 75).Select(x => new Order()
{
OrderID = 1000 + x,
CustomerID = (new string[] { "ALFKI", "ANANTR", "ANTON", "BLONP", "BOLID" })[new Random().Next(5)],
Freight = 2.1 * x,
OrderDate = DateTime.Now.AddDays(-x),
}).ToList();
}
public class Order
{
public int? OrderID { get; set; }
public string CustomerID { get; set; }
public DateTime? OrderDate { get; set; }
public double? Freight { get; set; }
}
public void RowDeselectHandler(RowDeselectEventArgs args)
{
Console.WriteLine("deselect");
// Here you can customize your code
}
public void Load(object args)
{
var RowHeight = 35; //height of the each row
Int32.TryParse(this.DefaultGrid.Height, out GridHeight); //grid height
var PageSize = (this.DefaultGrid.PageSettings as GridPageSettings).PageSize; //initial page size
var PageResize = ((GridHeight) - (PageSize * RowHeight)) / RowHeight; //new page size is obtained here
(this.DefaultGrid.PageSettings as GridPageSettings).PageSize = PageSize + Math.Floor(PageResize);
}
}