Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
146308 | Jul 30,2019 06:24 PM UTC | Aug 10,2019 04:38 AM UTC | ReactJS | 5 |
![]() |
Tags: ejGrid |
<div id="Grid"></div>
<script type="text/babel">
$(function(){
var data = ej.DataManager({url: "/Grid/DataSource", adaptor:"UrlAdaptor"});
var settings = { width: 550, height: 300, enableVirtualization: true };
ReactDOM.render(
<div id="Grid2">
<table>
<tr>
<td>
<EJ.Grid id="Grid_1" dataSource={data} allowScrolling={true} allowSorting={true} scrollSettings={settings}>
<columns>
………………………………………………………………………………..
</columns>
</EJ.Grid>
</td>
</tr>
</table>
</div>,
document.getElementById('Grid')
);
});
</script>
public IEnumerable OrderData = new NorthwindDataContext().OrdersViews.ToList();
public ActionResult DataSource(DataManager dataManager)
{
IEnumerable data = OrderData;
DataOperations operation = new DataOperations();
if (dataManager.Sorted != null && dataManager.Sorted.Count > 0) //Sorting
{
data = operation.PerformSorting(data, dataManager.Sorted);
}
if (dataManager.Where != null && dataManager.Where.Count > 0) //Filtering
{
data = operation.PerformWhereFilter(data, dataManager.Where, dataManager.Where[0].Operator);
}
int count = data.Cast<OrdersView>().Count();
if (dataManager.Skip != 0)
{
data = operation.PerformSkip(data, dataManager.Skip);
}
if (dataManager.Take != 0)
{
data = operation.PerformTake(data, dataManager.Take);
}
return Json(new { result = data, count = count });
}
|
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.