Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
147721 | Sep 21,2019 11:53 AM UTC | Sep 30,2019 11:14 AM UTC | Blazor | 4 |
![]() |
Tags: Grid |
@using Microsoft.JSInterop
@using Syncfusion.EJ2.Blazor.Grids
<EjsGrid DataSource="@Orders" AllowSorting="true" AllowPaging="true" AllowGrouping="true" Toolbar="@(new List<string>() { "Add","Update", “Delete”})">
...
</EjsGrid>
@code{
[Inject]
IJSRuntime JsRuntime { get; set; }
...
protected override void OnAfterRender(bool firstRender)
{
this.JsRuntime.Ejs().LoadLocaleData("wwwroot/de.json").SetCulture("de");
}
}
|
npm install cldr-data
|
public class CustomAdaptor : DataAdaptor
{
...
public override object Read(DataManagerRequest dm, string key = null) //Handle the sort, filter, search, paging actions here
{
IEnumerable<OrdersDetails> DataSource = order;
if (dm.Search != null && dm.Search.Count > 0)
{
//You can handle your custom Search action codes instead of using PerformSearching
}
if (dm.Sorted != null && dm.Sorted.Count > 0) //Sorting
{
//You can handle your custom Sort action codes instead of using PerformSorting
}
if (dm.Where != null && dm.Where.Count > 0) //Filtering
{
//You can handle your custom filter action codes instead of using PerformFiltering
}
int count = DataSource.Cast<OrdersDetails>().Count();
if (dm.Skip != 0)
{
//You can handle your custom skip action codes for paging instead of using PerformSkip
}
if (dm.Take != 0)
{
//You can handle your custom take action codes for paging instead of using PerformTake
}
return dm.RequiresCounts ? new DataResult() { Result = DataSource, Count = count } : (object)DataSource; //Finally return the result after your custom operations, as like Result and Count pair
}
public override object Insert(DataManager dm, object value, string key)
{
//Handle your custom insert operation and return the value
return value;
}
public override object Remove(DataManager dm, object value, string keyField, string key)
{
//Handle your custom delete operation and return the value
return value;
}
public override object Update(DataManager dm, object value, string keyField, string key)
{
//Handle your custom update operation and return the value
return value;
}
}
|
protected override void OnAfterRender(bool firstRender)
{
string url = "http://cdn.syncfusion.com/content/json/de.json";
string filepath = @"D:\new.json";
using (WebClient json = new MyWebClient())
{
json.DownloadFile(url, filepath);
}
this.JsRuntime.Ejs().LoadLocaleData(filepath).SetCulture("de");
} |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.