The data that is not paginated or sorted. When pagination is enabled, this property usually contains more elements than [[models]]. The array elements must use zero-based integer keys.
An ID that uniquely identifies the data provider among all data providers. Generated automatically the following way in case it is not set:
A Promise which resolves when this Component has been successfully initialized.
The column that is used as the key of the data models. This can be either a column name, or a callback that returns the key value of a given data model. If this is not set, the index of the [[models]] array will be used.
Model Class which can be used for resolving Attribute Labels, Hints etc.
Promise which resolves to the number matching records for the current query.
Returns the number of data models in the current page.
the number of data models in the current page.
Returns the key values associated with the data models.
the list of key values corresponding to [[models]]. Each data model in [[models]] is uniquely identified by the corresponding key value in this array.
Returns the data models in the current page.
the list of data models in the current page.
Returns the pagination object used by this data provider. Note that you should call prepare or getModels first to get correct values of Pagination.totalCount and [[Pagination::pageCount]].
the pagination object. If this is false, it means the pagination is disabled.
Returns the sorting object used by this data provider.
the sorting object. If this is false, it means the sorting is disabled.
Returns the total number of data models. When pagination is false, this returns the same value as count. Otherwise, it will call prepareTotalCount to get the count.
total number of possible data models.
Initializes the object. This method is invoked at the end of the constructor after the object is initialized with the given configuration.
Prepares the data models and keys.
whether to force data preparation even if it has been done before.
{@inheritdoc}
{@inheritdoc}
{@inheritdoc}
Refreshes the data provider. After calling this method, if getModels, getKeys or getTotalCount is called again, they will re-execute the query and return the latest data available.
Sets the data models in the current page.
the models in the current page
Sets the pagination for this data provider.
the pagination to be used by this data provider. This can be one of the following:
Sets the sort definition for this data provider.
the sort definition to be used by this data provider. This can be one of the following:
Sets the total number of data models.
the total number of data models.
Generated using TypeDoc
ArrayDataProvider implements a data provider based on a data array.
The allModels property contains all data models that may be sorted and/or paginated. ArrayDataProvider will provide the data after sorting and/or pagination. You may configure the [[sort]] and pagination properties to customize the sorting and pagination behaviors.
Elements in the allModels array may be either objects (e.g. model objects) or associative arrays (e.g. query results of DAO). Make sure to set the key property to the name of the field that uniquely identifies a data record or false if you do not have such a field.
Compared to ActiveDataProvider, ArrayDataProvider could be less efficient because it needs to have allModels ready.
ArrayDataProvider may be used in the following way:
Note: if you want to use the sorting feature, you must configure the [[sort]] property so that the provider knows which columns can be sorted.
For more details and usage information on ArrayDataProvider, see the guide article on data providers.
Mahesh S Warrier https://github.com/codespede