Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions blazor/datagrid/connecting-to-adaptors/custom-adaptor.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,26 @@ The following sample code demonstrates how to inject a service into the Custom A
</SfGrid>

@code{

protected override void OnInitialized()
{
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; }
}

// Custom adaptor class that extends the DataAdaptor class.
public class CustomAdaptor : DataAdaptor
{
Expand Down Expand Up @@ -985,6 +1005,26 @@ The following sample code demonstrates how to implement CRUD operations for cust
</SfGrid>

@code{

protected override void OnInitialized()
{
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; }
}

// Custom adaptor implementation by extending the DataAdaptor class.
public class CustomAdaptor : DataAdaptor
{
Expand Down