Class kartik\dynagrid\DynaGridStore

Inheritancekartik\dynagrid\DynaGridStore » yii\base\BaseObject
Implementsyii\base\Configurable
Available since version1.2.0

Dynagrid storage configuration object

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$category string The category of data to store kartik\dynagrid\DynaGridStore
$dbUpdateNameOnly boolean Whether to update only the name, when editing and saving a filter or sort. kartik\dynagrid\DynaGridStore
$dtlKey string The detail key identifier if available kartik\dynagrid\DynaGridStore
$id string The dynagrid identifier kartik\dynagrid\DynaGridStore
$moduleId string The module identifier if this object is part of a module. kartik\dynagrid\DynaGridStore
$name string The name to identify the filter or sort. kartik\dynagrid\DynaGridStore
$storage string The type of storage for the dynagrid configuration. kartik\dynagrid\DynaGridStore
$userSpecific boolean Whether settings are stored specific to each user kartik\dynagrid\DynaGridStore

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$_dtlKey string Generated storage key for dynagrid detail record (filter & sort) kartik\dynagrid\DynaGridStore
$_module kartik\dynagrid\Module The current module kartik\dynagrid\DynaGridStore
$_mstKey string Generated storage key for dynagrid master record kartik\dynagrid\DynaGridStore

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__call() Calls the named method which is not a class method. yii\base\BaseObject
__construct() Constructor. yii\base\BaseObject
__get() Returns the value of an object property. yii\base\BaseObject
__isset() Checks if a property is set, i.e. defined and not null. yii\base\BaseObject
__set() Sets value of an object property. yii\base\BaseObject
__unset() Sets an object property to null. yii\base\BaseObject
canGetProperty() Returns a value indicating whether a property can be read. yii\base\BaseObject
canSetProperty() Returns a value indicating whether a property can be set. yii\base\BaseObject
className() Returns the fully qualified name of this class. yii\base\BaseObject
delete() Delete configuration from store. Both master and detail records will be deleted. kartik\dynagrid\DynaGridStore
deleteConfig() Delete a key from data configuration for STORE_GRID kartik\dynagrid\DynaGridStore
fetch() Fetch configuration from store kartik\dynagrid\DynaGridStore
getDtlList() Fetch and return the list of detail values for a specific master (category = STORE_GRID) instance kartik\dynagrid\DynaGridStore
hasMethod() Returns a value indicating whether a method is defined. yii\base\BaseObject
hasProperty() Returns a value indicating whether a property is defined. yii\base\BaseObject
init() Initializes the object kartik\dynagrid\DynaGridStore
save() Save configuration to store kartik\dynagrid\DynaGridStore
setKey() Sets the unique storage key kartik\dynagrid\DynaGridStore

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
fetchConfig() Fetches configuration for session or cookie storage kartik\dynagrid\DynaGridStore
generateConfig() Gets configuration for session or cookie storage kartik\dynagrid\DynaGridStore
generateKey() Generates the storage key kartik\dynagrid\DynaGridStore
getDataFromDb() Fetch and return the relevant column data from database kartik\dynagrid\DynaGridStore
getDtlListOther() Fetches and return the list of detail values for session or cookie storage kartik\dynagrid\DynaGridStore
parseConfig() Parses configuration for session or cookie storage kartik\dynagrid\DynaGridStore

Constants

Hide inherited constants

ConstantValueDescriptionDefined By
STORE_FILTER 'filter' Grid filter configuration storage kartik\dynagrid\DynaGridStore
STORE_GRID 'grid' Grid configuration storage kartik\dynagrid\DynaGridStore
STORE_SORT 'sort' Grid sort configuration storage kartik\dynagrid\DynaGridStore

Property Details

$_dtlKey protected property

Generated storage key for dynagrid detail record (filter & sort)

protected string $_dtlKey null
$_module protected property

The current module

$_mstKey protected property

Generated storage key for dynagrid master record

protected string $_mstKey null
$category public property

The category of data to store

public string $category self::STORE_GRID
$dbUpdateNameOnly public property

Whether to update only the name, when editing and saving a filter or sort. This is applicable only for $storage set to Dynagrid::TYPE_DB. If set to false, it will also overwrite the current filter or sort settings.

public boolean $dbUpdateNameOnly false
$dtlKey public property

The detail key identifier if available

public string $dtlKey null
$id public property

The dynagrid identifier

public string $id null
$moduleId public property

The module identifier if this object is part of a module. If not set, the module identifier will be auto derived based on the \yii\base\Module::getInstance method. This can be useful, if you are setting multiple module identifiers for the same module in your Yii configuration file. To specify children or grand children modules you can specify the module identifiers relative to the parent module (e.g. admin/content).

public string $moduleId null
$name public property

The name to identify the filter or sort. This is applicable only if category is one of: kartik\dynagrid\DynaGridStore::STORE_FILTER or kartik\dynagrid\DynaGridStore::STORE_SORT

public string $name null
$storage public property

The type of storage for the dynagrid configuration.

public string $storage = \kartik\dynagrid\DynaGrid::TYPE_SESSION
$userSpecific public property

Whether settings are stored specific to each user

public boolean $userSpecific true

Method Details

delete() public method

Delete configuration from store. Both master and detail records will be deleted.

public void delete ( )
throws yii\base\InvalidConfigException
deleteConfig() public method

Delete a key from data configuration for STORE_GRID

public void deleteConfig ( $key, $config )
$key string

To delete

$config mixed

Configuration data

throws yii\base\InvalidConfigException
fetch() public method

Fetch configuration from store

public boolean|array fetch ( $col 'dataAttr' )
$col string

The column attribute

return boolean|array

The column configuration

throws yii\base\InvalidConfigException
fetchConfig() protected method

Fetches configuration for session or cookie storage

protected boolean|array fetchConfig ( $config )
$config
return boolean|array

Configuration for master or detail

throws Exception
generateConfig() protected method

Gets configuration for session or cookie storage

protected string generateConfig ( $config, $data )
$config string

The configuration to merge

$data string

The Json::encoded data

return string

The Json::encoded configuration

generateKey() protected method

Generates the storage key

protected string generateKey ( $master true )
$master boolean

Whether to generate key for the master record

getDataFromDb() protected method

Fetch and return the relevant column data from database

protected boolean|null|string getDataFromDb ( $col, $id )
$col string

The column type

$id string

The primary key value

throws Exception
getDtlList() public method

Fetch and return the list of detail values for a specific master (category = STORE_GRID) instance

public array getDtlList ( $cat )
$cat string

The detail category

throws yii\base\InvalidConfigException
getDtlListOther() protected static method

Fetches and return the list of detail values for session or cookie storage

protected static array getDtlListOther ( $config, $cat )
$config array

The storage configuration

$cat string

The detail category

init() public method

Initializes the object

public void init ( )
throws yii\base\InvalidConfigException
parseConfig() protected static method

Parses configuration for session or cookie storage

protected static array parseConfig ( $config )
$config
return array

The store configuration

save() public method

Save configuration to store

public void save ( $config )
$config mixed

Configuration data to save

throws yii\base\InvalidConfigException
setKey() public method

Sets the unique storage key

public void setKey ( )