DataAdapter

Data binds to an external data source. Supports JSON, XML, CSV, TSV and Array data types. Used as a source for multiple components like Grids, Charts, CardView, etc.

Selector

smartDataAdapter

Properties

autoBindboolean

Sets or gets whether the binding is automatic after creating a data adapter instance.

Default valuetrue

asyncboolean

Sets or gets whether the binding is asynchronous.

Default valuefalse

boundSourceany[]

Gets the bound data source after the binding is completed.

Default value

boundHierarchyany[]

Gets the bound hierarchical data source after the binding is completed.

Default value

childrenDataFieldstring

Sets or gets a children data field like 'children', 'items' in the data source. When this property is set, the dataAdapter will look for this data field when looping through the items. If it is found a hierarchical data source would be created.

Default value"

groupBystring[]

Sets or gets the data fields to group by.

Default value[]

dataFieldsstring[]

Sets or gets the data fields which decribe the loaded data and data type. Ex: ['id: number', 'firstName: string', 'lastName: string']

Default valuestring[]

dataSourceany

Sets or gets the data source of the adapter.

Default value[]

dataSourceTypeDataAdapterDataSourceType

Sets or gets whether the data source type.

Default valuearray

idstring

Sets or gets the dataAdapter's id

Default value"

keyDataFieldstring

Sets or gets the key data field to be used for building the hierarchy. It is used in combination with the parentDataField property. Usually the 'id' field is used as key data field and 'parentId' as parent data field'

Default value"

lengthnumber

Gets the data source length.

Default value0

methodDataAdapterMethod

Sets or gets whether the request type.

Default valueGET

parentDataFieldstring

Sets or gets the parent data field to be used for building the hierarchy. It is used in combination with the keyDataField property. Usually the 'id' field is used as key data field and 'parentId' as parent data field'

Default value"

virtualDataSourceOnExpandDataAdapterVirtualDataSourceOnExpand[]

Sets or gets the virtual data source on expand function. This function is called when we load data on demand in Tree or TreeGrid and virtualDataSource in these components is set, too

virtualDataSourceLengthnumber

Sets or gets the total length of items. If it is unknown, do not set this parameter.

Default value0

virtualDataSourceCacheboolean

Sets or gets a boolean param which determines whether to cache or not the new loaded data.

Default valuetrue

virtualDataSourceDataAdapterVirtualDataSource[]

Sets or gets the virtual data source function

Methods

add( item: any, parentId?: string | number): void

Adds a new item.

Arguments

itemany

A new data source item.

parentId?string | number

id of a parent data item, when we want to add a child in a hierarchy


clear(): void

Clears the adapter.


clearSort(): void

Clears the sorting.


clearFilter(): void

Clears the filters.


clearGroup(): void

Clears the grouping.


dataBind(): void

Data binds the adapter to the data source. If the data source is remote, perform a new AJAX call.


notify( callback: any): void

Notifies for data changes like adding, removing, updating items.

Arguments

callbackany

The callback function which is called when a change happened. { action: 'add' | 'bindingComplete' | 'removeLast' | 'remove' | 'move' | 'update' | 'insert', data: [], index?: number }


find( callback: any): any

The find method returns the value of the first element in the provided array that satisfies the provided testing function.

Arguments

callbackany

Function to execute on each value in the array, taking 2 arguments - element and index. The element is the current item in the array. The index is the index of the current element.

Returnsany

filter( dataFields: string[], filterGroups: any): void

Filters the data source.

Arguments

dataFieldsstring[]

The data fields.

filterGroupsany

The filter group objects.


filterBy( dataField: string, filterExpessions: string[]): void

Filters the data source.

Arguments

dataFieldstring

The data field.

filterExpessionsstring[]

Filter expression like '= 5'. Allowed operators '=', '<','>','<>', '<=', '>=', 'starts with','contains','ends with', '', 'null'


indexOf( index: number): any

Gets the index of an item.

Arguments

indexnumber

The index of the item.

Returnsany

insert( index: number, item: any): void

Inserts an item.

Arguments

indexnumber

The index where to insert the item.

itemany

An object containing the values for the properties of the item that will be updated.


move( from: number, to: number): void

Moves an item.

Arguments

fromnumber

The item's old index.

tonumber

The item's new index.


removeLast(): void

Removes the last item from the data source.


removeAt( position: number): void

Removes an item at a specified index.

Arguments

positionnumber

The index of the item to be removed.


sort( dataFields: string[], sortOrders: string[]): void

Sorts the data source.

Arguments

dataFieldsstring[]

The data fields.

sortOrdersstring[]

The sort orders array with 'asc' or 'desc' or null values.


sortBy( dataField: string, dataType: string, sortOrder: string): void

Sorts the data source.

Arguments

dataFieldstring

The data field.

dataTypestring

The type of the data field - string, number, date, boolean.

sortOrderstring

The sort order - 'asc' or 'desc' or null.


summarize( summaryItems: any[]): void

Aggregates data from the data source.

Arguments

summaryItemsany[]

The summary items. Each summary item represents a data field with summary function: 'avg' - Average aggregate, 'count' - Count aggregate, 'min' - Min aggregate, 'max' - Max aggregate, 'sum' - Sum aggregate, 'product' - Product aggregate, 'stdev' - Standard deviation on a sample., 'stdevp' - Standard deviation on an entire population., 'varp' - Variance on an entire population., 'var' - Variance on a sample.


toArray(): any[]

Returns an array of all items.

Returnsany[]

update( index: number, item: any): void

Updates an item from the element.

Arguments

indexnumber

The index of the item to be updated.

itemany

An object containing the values for the properties of the item that will be updated.



DataAdapterVirtualDataSourceOnExpand

Properties

resultCallbackFunctionDataAdapterVirtualDataSourceOnExpandResultCallbackFunction

Result callback function which is executed when the data loading is completed.

detailsDataAdapterVirtualDataSourceOnExpandDetails

Details of the object, which made the request


Result callback function which is executed when the data loading is completed.

DataAdapterVirtualDataSourceOnExpandResultCallbackFunction

Properties

settingsany

result callback function settings


DataAdapterVirtualDataSourceOnExpandDetails

Properties

firstnumber

Data start index.

Default value0

lastnumber

Data end index.

Default value0

sortingDataAdapterVirtualDataSourceOnExpandDetailsSorting

Sorting information.

filteringany

Filtering information.

groupingstring[]

Grouping information

Default value[]

actionDataAdapterVirtualDataSourceOnExpandDetailsAction

Request action type

Default valueundefined

Details of the object, which made the request

DataAdapterVirtualDataSourceOnExpandDetailsSorting

Properties

sortOrderDataAdapterVirtualDataSourceOnExpandDetailsSortingSortOrder

Sort order.

Default valueasc

sortIndexnumber

Sort index.

Default value-1

Sorting information.

DataAdapterVirtualDataSource

Properties

resultCallbackFunctionDataAdapterVirtualDataSourceResultCallbackFunction

Result callback function which is executed when the data loading is completed.

detailsDataAdapterVirtualDataSourceDetails

Details of the object, which made the request


Result callback function which is executed when the data loading is completed.

DataAdapterVirtualDataSourceResultCallbackFunction

Properties

settingsany

result callback function settings


DataAdapterVirtualDataSourceDetails

Properties

firstnumber

Data start index.

Default value0

lastnumber

Data end index.

Default value0

sortingDataAdapterVirtualDataSourceDetailsSorting

Sorting information.

filteringany

Filtering information.

groupingstring[]

Grouping information

Default value[]

actionDataAdapterVirtualDataSourceDetailsAction

Request action type

Default valueundefined

Details of the object, which made the request

DataAdapterVirtualDataSourceDetailsSorting

Properties

sortOrderDataAdapterVirtualDataSourceDetailsSortingSortOrder

Sort order.

Default valueasc

sortIndexnumber

Sort index.

Default value-1

Sorting information.

Enums

DataAdapterDataSourceType

Array Json Xml Csv Tsv

DataAdapterMethod

GET POST

DataAdapterVirtualDataSourceDetailsAction

Sort Filter DataBind Scroll Group Expand PageIndexChange PageSizeChange

DataAdapterVirtualDataSourceDetailsSortingSortOrder

Asc Desc

DataAdapterVirtualDataSourceOnExpandDetailsAction

Sort Filter DataBind Scroll Group Expand PageIndexChange PageSizeChange

DataAdapterVirtualDataSourceOnExpandDetailsSortingSortOrder

Asc Desc