Your search did not match any results.
Data Grid

OData Service


To fetch data from an OData service, implement an ODataStore. Use its options to specify the service's url, key data field, and OData version if it is different from 2.

You can configure ODataStore as a standalone component (see OData for details), but this demo assigns ODataStore settings to the store field of the DataSource configuration object. If you follow the same pattern in your application, make sure to set the store's type option to "odata".

The DataSource configuration object allows you to sort, filter, group, and otherwise shape the store's data objects. This demo filters data and selects a limited number of fields.

@(Html.DevExtreme().DataGrid() .ShowBorders(true) .DataSource(d => d.OData() .Url("") .Key("Product_ID") ) .DataSourceOptions(d => d.Select(new[] { "Product_ID", "Product_Name", "Product_Cost", "Product_Sale_Price", "Product_Retail_Price", "Product_Current_Inventory" }) .Filter("['Product_Current_Inventory', '>' , 0]") ) .Columns(columns => { columns.Add() .DataField("Product_ID"); columns.Add() .DataField("Product_Name") .Width(250); columns.Add() .Caption("Cost") .DataField("Product_Cost") .DataType(GridColumnDataType.Number) .Format(Format.Currency); columns.Add() .DataField("Product_Sale_Price") .Caption("Sale Price") .DataType(GridColumnDataType.Number) .Format(Format.Currency); columns.Add() .DataField("Product_Retail_Price") .Caption("Retail Price") .DataType(GridColumnDataType.Number) .Format(Format.Currency); columns.Add() .DataField("Product_Current_Inventory") .Caption("Inventory"); }) )
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 ODataService() { return View(); } } }