Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
141605 | Dec 20,2018 09:12 AM UTC | Dec 24,2020 12:02 PM UTC | ASP.NET MVC - EJ 2 | 4 |
![]() |
Tags: Grid |
...
function begin(args) {
if (args.requestType == 'filterbeforeopen') {
cloneQuery = this.query;
this.query = new ej.data.Query().addParams("excelfilter", true);
}
}... |
[.cs]
...
if (dm.excelfilter)
{
DataSource = operation.PerformTake(DataSource, 2); //we have just passed the first two records to the excel filter items
//You can change the filter data according to your requirement here
}
... |
// Grid’s actionBegin event function
function onActionBegin(args) {
if (args.requestType === "filterchoicerequest") {‘
// Filter choice count is modified
args.filterChoiceCount = 1500; //modify value here as you want
}
} |
<script>
function begin(args) {
if (args.requestType === "filterchoicerequest") {
var filterfields = [];
var objFilter = Object.keys(args.filterModel.existingPredicate);
for (var i = 0; i < objFilter.length; i++) {
filterfields.push(objFilter[i]);
}
filterfields.push(args.filterModel.options.field);
args.query.distincts = [];
args.query.select(filterfields); // Created the select query
}
}
</script>
|
public IActionResult UrlDatasource([FromBody]DataManagerRequest dm)
{
IEnumerable DataSource = order;
DataOperations operation = new DataOperations();
. . . . . . . .
int count = DataSource.Cast<Orders>().Count();
if (dm.Select != null)
{
DataSource = operation.PerformSelect(DataSource, dm.Select); // Selected the columns value based on the filter request
DataSource = DataSource.Cast<dynamic>().Distinct().AsEnumerable(); // Get the distinct values from the selected column
}
. . . . . .
return dm.RequiresCounts ? Json(new { result = DataSource, count = count }) : Json(DataSource);
}
|
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.