|
<ej-grid id="Grid" allow-paging="true" is-responsive="true" min-width="500" enable-responsive-row="true" action-complete="complete" selectiontype="Multiple" >
….
<e-datamanager url="/Home/DataSource" adaptor="UrlAdaptor" insert-url="/Home/Insert" update-url="/Home/Update" remove-url="/Home/Delete" ></e-datamanager>
……
</ej-grid>
<script>
function complete(args) {
if (args.requestType == "paging") {
var length = this.model.currentViewData.length;
var lastindex = length - 1;
this.selectRows(0, lastindex);
}
}
</script> |
Hi all
Thanks for the solution. But i want to send all the data from the filtered Grid to my Controller. I get only the Rows in the CurrentViewData. In my Case only 30 Rows.
Regards,
Adrian
|
public ActionResult DataSource([FromBody]DataManager dm)
{
IEnumerable data = _context.Orders.Take(100).ToList();
DataOperations operation = new DataOperations();
if (dm.Sorted != null && dm.Sorted.Count > 0) //Sorting
{
data = operation.PerformSorting(data, dm.Sorted);
}
if (dm.Where != null && dm.Where.Count > 0) //Filtering
{
data = operation.PerformWhereFilter(data, dm.Where, dm.Where[0].Operator); //here the filtered records are stored in data variable you can use this data when grid is filtered
}
int count = data.Cast<Orders>().Count();
if (dm.Skip != 0)
{
data = operation.PerformSkip(data, dm.Skip);
}
if (dm.Take != 0)
{
data = operation.PerformTake(data, dm.Take);
}
return Json(new { result = data, count = count });
}
|