- Home
- Forum
- ASP.NET Core - EJ 2
- QueryableDataOperations
QueryableDataOperations
Is there some example of using QueryableDataOperations for the EJ2 datagrid?
I'm using the latest version of the controls.
Thanks!
Bernard.
SIGN IN To post a reply.
3 Replies
1 reply marked as answer
BS
Balaji Sekar
Syncfusion Team
August 10, 2020 06:04 AM UTC
Hi Bernard,
Greetings from the Syncfusion support.
As per your query, we have created a sample with using the IQueryableoperation in server side. Since you are using data returned from DB, we suggest you to use IQueryable interface instead of IEnumerable since it improves performance for this data. For Queryable data you need to use the QueryableOperation to perform the operations instead of DataOperations.
|
[HomeController.cs]
public ActionResult UrlDatasource(DataManagerRequest dm)
{
IQueryable DataSource = db.C30000Records.AsQueryable();
QueryableOperation operation = new QueryableOperation();
if (dm.Where != null)
{
DataSource = operation.PerformFiltering((IQueryable<C30000Records>)DataSource, dm.Where, dm.Where[0].Condition);
if (!dm.RequiresCounts)
{
return Json(DataSource);
}
}
if (dm.Search != null)
{
DataSource = operation.PerformSearching((IQueryable<C30000Records>)DataSource, dm.Search);
}
int count = DataSource.Cast<C30000Records>().Count();
if (dm.Sorted != null)
{
DataSource = operation.PerformSorting((IQueryable<C30000Records>)DataSource, dm.Sorted);
}
if (dm.Skip != 0)
{
DataSource = operation.PerformSkip((IQueryable<C30000Records>)DataSource, dm.Skip); //Paging
}
if (dm.Take != 0)
{
DataSource = operation.PerformTake((IQueryable<C30000Records>)DataSource, dm.Take);
}
var countData = Json(new { result = DataSource, count = count }, JsonRequestBehavior.AllowGet);
var orgData = Json(DataSource, JsonRequestBehavior.AllowGet);
countData.MaxJsonLength = int.MaxValue;
orgData.MaxJsonLength = int.MaxValue;
return dm.RequiresCounts ? countData : orgData;
} |
Sample link: https://www.syncfusion.com/downloads/support/forum/156745/ze/GridSearching447164961-1032065606.zip
Please get back to us, if you need further assistance.
Regards,
Balaji Sekar
Marked as answer
BJ
Bernard Jurlina
August 10, 2020 05:38 PM UTC
Excellent!
Thanks Balaji, I'll try your example.
Regards!
Bernard.
BS
Balaji Sekar
Syncfusion Team
August 11, 2020 04:38 AM UTC
Hi Bernard,
Thanks for the update.
Please get back to us if you require further other assistance from us
Regards,
Balaji Sekar.
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
- Marked answer
-
BJ Bernard Jurlina
- Aug 8, 2020 08:03 AM UTC
- Aug 11, 2020 04:38 AM UTC