...
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);
}
|
Hi, i've been trying to apply this feature, but haven't been able to.
For example, on column Status, i have 10 options: from Status A, Status B, till Status J.
Issue 1: When i display the filter, the Status B is missing:
But, if i check the function, the Status B is also missing: