-
Notifications
You must be signed in to change notification settings - Fork 15
Specify Data Sources
Use the <datasource> tag to connect a data-driven widget (such as dxDataGrid or dxChart) to a data source.
There are currently three main data-binding options available:
<datasource items="new[] { Item1, Item2, Item3 }" />The specified collection is serialized into JSON and written to the page markup.
<datasource url="http://example.com/data.json" />or, for JSONP:
<datasource url="http://example.com/data.js?callback=?" /><datasource controller="Northwind" load-action="Products" ... />This option allows to implement full CRUD data sources for any IEnumerable / IQueryable data. Refer to the Connect to Data Using Entity Framework Core tutorial for more information.
Supported attributes:
<datasource controller="Home"
load-action="LoadItems"
update-action="UpdateItem"
insert-action="InsertItem"
delete-action="DeleteItem"
update-method="PUT"
insert-method="POST"
delete-method="DELETE"
key="itemID"
on-before-send="function(operation, ajaxSettings) { }" />Primary key fields are specified via the key attribute. Simple and compound keys are supported:
<datasource key="productID" /><datasource key="orderID, productID">The dxPivotGrid widget (<dx-pivot-grid> tag) uses a special extended data source with additional attributes. See the PivotGridDataSource topic for details.
To implement any custom client-side data-binding logic, use techniques described in the Use JavaScript with Tag Helpers (Event Handlers, Templates, etc) and Custom Sources articles.