Your search did not match any results.
Data Grid

Remote Grouping


The DataGrid widget allows your end users to shape data as needs dictate. In this example, we demonstrate the use of the built-in data grouping feature against a remote data source. Data is provided by an OData service and grid content is grouped by both Status and Priority columns. Note that this demo uses the DataGrid in a virtual mode and loads data on-demand as the grid content is scrolled vertically.

@(Html.DevExtreme().DataGrid() .ID("gridContainer") .ShowBorders(true) .DataSource(d => d.OData() .Url("") .Key("Task_ID") .Expand("ResponsibleEmployee") ) .DataSourceOptions(d => d.Select(new string[] { "Task_ID", "Task_Subject", "Task_Start_Date", "Task_Due_Date", "Task_Status", "Task_Priority", "ResponsibleEmployee/Employee_Full_Name" }) ) .Scrolling(scrolling => scrolling.Mode(GridScrollingMode.Virtual)) .GroupPanel(groupPanel => groupPanel.Visible(true)) .Columns(columns => { columns.Add() .DataField("Task_ID") .Width(90); columns.Add() .Caption("Subject") .DataField("Task_Subject") .Width(190); columns.Add() .Caption("Status") .DataField("Task_Status") .GroupIndex(0); columns.Add() .Caption("Priority") .DataField("Task_Priority") .GroupIndex(1) .Lookup(lookup => { lookup.DataSource(new List<object> { new { Name = "High", Value = 4 }, new { Name = "Urgent", Value = 3 }, new { Name = "Normal", Value = 2 }, new { Name = "Low", Value = 1 } }); lookup.ValueExpr("Value"); lookup.DisplayExpr("Name"); }); columns.Add() .Caption("Assigned To") .DataField("ResponsibleEmployee.Employee_Full_Name") .AllowGrouping(false) .AllowSorting(false); columns.Add() .Caption("Start Date") .DataField("Task_Start_Date") .DataType(GridColumnDataType.Date); columns.Add() .Caption("Due Date") .DataField("Task_Due_Date") .DataType(GridColumnDataType.Date); }) )
using DevExtreme.MVC.Demos.Models; using DevExtreme.MVC.Demos.Models.DataGrid; using DevExtreme.MVC.Demos.Models.SampleData; using System; using System.Linq; using System.Web.Mvc; namespace DevExtreme.MVC.Demos.Controllers { public class DataGridController : Controller { public ActionResult RemoteGrouping() { return View(); } } }
#gridContainer { height: 420px; }