Class kartik\dynagrid\DynaGridStore
Inheritance | kartik\dynagrid\DynaGridStore » yii\base\BaseObject |
---|---|
Implements | yii\base\Configurable |
Available since version | 1.2.0 |
Dynagrid storage configuration object
Public Properties
Property | Type | Description | Defined 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
Property | Type | Description | Defined 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
Method | Description | Defined 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
Method | Description | Defined 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
Constant | Value | Description | Defined 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
Generated storage key for dynagrid detail record (filter & sort)
The current module
Generated storage key for dynagrid master record
The category of data to store
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.
The detail key identifier if available
The dynagrid identifier
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
).
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
The type of storage for the dynagrid configuration.
- kartik\dynagrid\DynaGrid::TYPE_SESSION: Save the config in a session variable for the current session.
- kartik\dynagrid\DynaGrid::TYPE_COOKIE: Save the config in a cookie for retrieval. You need to setup the kartik\dynagrid\Module::$cookieSettings property to control the cookie expiry and other settings.
- kartik\dynagrid\DynaGrid::TYPE_DB: Save the config to a database. You need to setup the kartik\dynagrid\Module::$dbSettings property to setup the database table and attributes for storage.
Whether settings are stored specific to each user
Method Details
Delete configuration from store. Both master and detail records will be deleted.
public void delete ( ) | ||
throws | yii\base\InvalidConfigException |
---|
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 configuration from store
public boolean|array fetch ( $col = 'dataAttr' ) | ||
$col | string | The column attribute |
return | boolean|array | The column configuration |
---|---|---|
throws | yii\base\InvalidConfigException |
Fetches configuration for session or cookie storage
protected boolean|array fetchConfig ( $config ) | ||
$config | ||
return | boolean|array | Configuration for master or detail |
---|---|---|
throws | Exception |
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 |
---|
Generates the storage key
protected string generateKey ( $master = true ) | ||
$master | boolean | Whether to generate key for the master record |
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 |
---|
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 |
---|
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 |
Initializes the object
public void init ( ) | ||
throws | yii\base\InvalidConfigException |
---|
Parses configuration for session or cookie storage
protected static array parseConfig ( $config ) | ||
$config | ||
return | array | The store configuration |
---|
Save configuration to store
public void save ( $config ) | ||
$config | mixed | Configuration data to save |
throws | yii\base\InvalidConfigException |
---|
Sets the unique storage key
public void setKey ( ) |