DataSourceTagHelper
Configures a Kendo UI DataSource for standalone use or as a nested data source of a supported component.
Definition
Namespace:Kendo.Mvc.TagHelpers
Assembly:Kendo.Mvc.dll
Syntax:
[HtmlTargetElement("kendo-datasource")]
[HtmlTargetElement("datasource", ParentTag = "kendo-grid")]
[HtmlTargetElement("datasource", ParentTag = "kendo-chart")]
[HtmlTargetElement("datasource", ParentTag = "kendo-combobox")]
[HtmlTargetElement("datasource", ParentTag = "combobox-editor")]
[HtmlTargetElement("datasource", ParentTag = "kendo-multicolumncombobox")]
[HtmlTargetElement("datasource", ParentTag = "multicolumncombobox-editor")]
[HtmlTargetElement("datasource", ParentTag = "kendo-autocomplete")]
[HtmlTargetElement("datasource", ParentTag = "autocomplete-editor")]
[HtmlTargetElement("datasource", ParentTag = "kendo-dropdownlist")]
[HtmlTargetElement("datasource", ParentTag = "dropdownlist-editor")]
[HtmlTargetElement("datasource", ParentTag = "kendo-multiselect")]
[HtmlTargetElement("datasource", ParentTag = "multiselect-editor")]
[HtmlTargetElement("datasource", ParentTag = "kendo-listbox")]
[HtmlTargetElement("datasource", ParentTag = "sheet")]
[HtmlTargetElement("datasource", ParentTag = "layer")]
[HtmlTargetElement("datasource", ParentTag = "resource")]
[HtmlTargetElement("datasource", ParentTag = "resources")]
[HtmlTargetElement("datasource", ParentTag = "assignments")]
[HtmlTargetElement("datasource", ParentTag = "kendo-scrollview")]
[HtmlTargetElement("datasource", ParentTag = "kendo-timeline")]
[HtmlTargetElement("datasource", ParentTag = "kendo-taskboard")]
[HtmlTargetElement("datasource", ParentTag = "taskboard-columns")]
[HtmlTargetElement("datasource", ParentTag = "foreign-key-column")]
[HtmlTargetElement("datasource", ParentTag = "kendo-listview")]
[HtmlTargetElement("datasource", ParentTag = "kendo-sparkline")]
[HtmlTargetElement("connections-datasource", ParentTag = "kendo-diagram")]
[HtmlTargetElement("datasource", ParentTag = "kendo-stockchart")]
[HtmlTargetElement("datasource", ParentTag = "navigator")]
[HtmlTargetElement("datasource", ParentTag = "kendo-chartwizard")]
[HtmlTargetElement("datasource", ParentTag = "kendo-chat")]
[RestrictChildren("aggregates", new string[] { "filters", "groups", "schema", "sorts", "transport" })]
public class DataSourceTagHelper : TagHelperBase, ITagHelper, ITagHelperComponent
Inheritance: objectTagHelperTagHelperBaseDataSourceTagHelper
Derived Classes:
Implements:
Inherited Members
Example:
@addTagHelper *, Kendo.Mvc
//as standalone component
<kendo-datasource name="myDataSource" type="DataSourceTagHelperType.Ajax">
<transport>
<read url="@Url.Action("ReadOrders", "Home")" />
</transport>
</kendo-datasource>
//as part of a component definition
<kendo-combobox name="combobox"
datatextfield="ProductName"
datavaluefield="ProductID">
<datasource>
<transport>
<read url="@Url.Action("Products_Read", "ComboBox")"/>
</transport>
</datasource>
</kendo-combobox>
Child Tags
Constructors
Initializes a new instance of the DataSourceTagHelper class with the specified HTML generator.
public DataSourceTagHelper(IKendoHtmlGenerator generator)
Properties
Allows the filtering operation to be performed considering the diacritic characters for specific language. Since these characters are strictly specific for a specific language, setting the appropriate culture has to be set as a value. For example, tr-TR for Turkish, es-ES for Spanish, or fr-FR for French. Due to the specifics of the case-insensitive search, only one language can be used to filter your data. For example, if you mix English and Turkish in the data, you may observe unexpected behavior.
public string AccentFoldingFiltering { get; set; }
If set to true the data source would automatically save any changed data items by calling the sync method. By default, changes are not automatically saved.
public bool? AutoSync { get; set; }
If set to true, the data source will batch CRUD operation requests. For example, updating two data items would cause one HTTP request instead of two. By default, the data source makes a HTTP request for every CRUD operation.
public bool? Batch { get; set; }
Gets or sets a predefined transport and schema type. Supported values are odata for OData v2 and odata-v4 for partial OData v4 support.
public string CustomType { get; set; }
The collection of data items which the data source contains.
public IEnumerable Data { get; set; }
If set to true, the data source will treat groups as items.
public bool? GroupPaging { get; set; }
If set to true the original Array used as data will be sorted when sorting operation is performed. This setting supported only with local data, bound to a JavaScript array via the data option.
public bool? InPlaceSort { get; set; }
The offline storage key or custom offline storage implementation.
public string OfflineStorage { get; set; }
Fired when the data source is populated from a JavaScript array or a remote service, a data item is inserted, updated or removed, the data items are paged, sorted, filtered, or grouped.The event handler function context (available via the this keyword) will be set to the data source instance.
public string OnChange { get; set; }
Fired when a request to the remote service fails.The event handler function context (available via the this keyword) will be set to the data source instance.
public string OnError { get; set; }
Fired when the data source receives a push notification or the pushCreate, pushUpdate, or pushDestroy methods are called.
public string OnPush { get; set; }
Fired when a remote service request is finished.The event handler function context (available via the this keyword) will be set to the data source instance.
public string OnRequestEnd { get; set; }
Fired when the data source makes a remote service request.The event handler function context (available via the this keyword) will be set to the data source instance.It is possible to prevent the remote request. To achieve this, execute e.preventDefault() in the handler function.
public string OnRequestStart { get; set; }
Fired after the data source saves data item changes. The data source saves the data item changes when the sync method is called.The event handler function context (available via the this keyword) will be set to the data source instance.
public string OnSync { get; set; }
The page of data which the data source will return when the view method is invoked or request from the remote service.
public double? Page { get; set; }
The number of data items per page. The property has no default value. That is why to use paging, make sure some pageSize value is set.
public double? PageSize { get; set; }
If set to true, the data source will leave the aggregate calculation to the remote service. By default, the data source calculates aggregates client-side.For more information and tips about client and server data operations, refer to the introductory article on the DataSource.
public bool? ServerAggregates { get; set; }
If set to true, the data source will leave the filtering implementation to the remote service. By default, the data source performs filtering client-side.By default, the filter is sent to the server following jQuery's conventions.For example, the filter { logic: "and", filters: [ { field: "name", operator: "startswith", value: "Jane" } ] } is sent as: filter[logic]: and; filter[filters][0][field]: name; filter[filters][0][operator]: startswith or filter[filters][0][value]: Jane. Use the parameterMap option to send the filter option in a different format.For more information and tips about client and server data operations, refer to the introductory article on the DataSource.
public bool? ServerFiltering { get; set; }
If set to true, the data source will leave the grouping implementation to the remote service. By default, the data source performs grouping client-side.By default, the group is sent to the server following jQuery's conventions.For example, the group { field: "category", dir: "desc" } is sent as: group[0][field]: category or group[0][dir]: desc. Use the parameterMap option to send the group option in a different format.For more information and tips about client and server data operations, refer to the introductory article on the DataSource.
public bool? ServerGrouping { get; set; }
Gets or sets whether paging, sorting, filtering, and grouping are performed on the server. For Ajax and WebAPI data sources, server operations are enabled when this option is unspecified. Set to false to request all data in one request and perform these operations client-side.
public bool? ServerOperation { get; set; }
If set to true, the data source will leave the data item paging implementation to the remote service. By default, the data source performs paging client-side.The following options are sent to the server when server paging is enabled: page - the page of data item to return (1 means the first page).; pageSize - the number of items to return.; skip - how many data items to skip. or take - the number of data items to return (the same as pageSize).. Use the parameterMap option to send the paging options in a different format.For more information and tips about client and server data operations, refer to the introductory article on the DataSource.
public bool? ServerPaging { get; set; }
If set to true, the data source will leave the data item sorting implementation to the remote service. By default, the data source performs sorting client-side.By default, the sort is sent to the server following jQuery's conventions.For example, the sort { field: "age", dir: "desc" } is sent as: sort[0][field]: age or sort[0][dir]: desc. Use the parameterMap option to send the paging options in a different format.For more information and tips about client and server data operations, refer to the introductory article on the DataSource.
public bool? ServerSorting { get; set; }
Methods
AddSelfToContext method.
protected virtual void AddSelfToContext(TagHelperContext context)
Gets the initialization script.
protected override string GetInitializationScript()
The initialization script.
Overrides:
public override Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
Overrides:
Serializes the defined settings.
public override IDictionary<string, object> Serialize()
Overrides:
SerializeEvents method.
protected override Dictionary<string, object> SerializeEvents()
Overrides:
SetDataSource method.
SetDefaults method.
protected void SetDefaults()
Writes the HTML output.
protected override void WriteHtml(TagHelperOutput output)
The TagHelper output.
Overrides: