<EjsGrid TValue="Order" ID="Grid" AllowPaging="true" Toolbar="@(new List<string>() { "Edit", "Update", "Cancel" })">
<EjsDataManager AdaptorInstance="@typeof(CustomAdaptor)" Adaptor="Adaptors.CustomAdaptor"></EjsDataManager>
<GridEditSettings AllowEditing="true" Mode="@EditMode.Normal"></GridEditSettings>
...
</EjsGrid>
@code{
public static List<Order> Orders { get; set; }
...
// Implementing custom adaptor by extending the DataAdaptor class
public class CustomAdaptor : DataAdaptor
{
// Performs data Read operation to bind Data to Grid at initial loading
public override object Read(DataManagerRequest dm, string key = null)
{
...
return dm.RequiresCounts ? new DataResult() { Result = DataSource, Count = count } : (object)DataSource;
}
// Performs Update operation
public override object Update(DataManager dm, object value, string keyField, string key)
{
//Handle your custom update operation and return the value
return value;
}
}
}
|