Download the PHP package popov/zfc-data-grid-plugin without Composer
On this page you can find all versions of the php package popov/zfc-data-grid-plugin. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download popov/zfc-data-grid-plugin
More information about popov/zfc-data-grid-plugin
Files in popov/zfc-data-grid-plugin
Package zfc-data-grid-plugin
Short Description ZF module manager which extend possibility of ZfcDatagrid
License MIT
Informations about the package zfc-data-grid-plugin
ZF2 DataGrid Plugin Module
Welcome to the official ZfcDataGrid documentation. This documentation will help you to quickly understand how to use ZfcDataGrid.
If you are looking for some information that is not listed in the documentation, please open an issue!
ZF DataGrid Plugin Module based on ZfcDatagrid and is a kind of superstructure. Its main goal to reduce using complexity and improve code readability.
This module register new data_grid_plugins
global config key and add ColumnFactory
.
Working principle is using ZF2 way like which use array configuration for create form elements.
Important!
DataGridPluginManager
set$shareByDefault = false
, this allow avoid redundant classes declaration in configuration.
Usage
Register Plugin. For this move content of in global
In general you create new Grid class which will be response for concrete Grid in your ecosystem.
Columns
Columns Introduction
The column definition is a central part of ZfcDataGrid
, they are used to tell the grid what columns to display and how to display them.
Column Types
Select
A minimal column definition looks like this:
GROUP_CONCAT
Doctrine
Sometimes we need use built-in database functions for aggregate result. For this purpose we need give or as argument to column.
Advanced Usage\
Doctrine DOES NOT support expression below and throw Exception [Syntax Error] line 0, col 218: Error: Unexpected 'NULL'
:
Insteat of example above you can use NULLIF
operator (which is supported):
Notice: Some functions like GROUP_CONCAT is represented only in one database so Doctrine don't support it by default so you need include relative package to you project.
ZendTable
Column Data Types
Number
The Number
(original: Type\Number
)
column data types is used to format numbers using the PHP NumberFormatter,
and so you can use the NumberFormatter properties in this data type, to do so you create a Number
object
which can takes the following parameters in order:
- Format Style: default
NumberFormatter::DECIMAL
- Format Type: default
NumberFormatter::TYPE_DEFAULT
- Locale: Default
Locale::getDefault()
You can also do the following for this type:
'type' => ['prefix' => 'prefix']
'type' => ['suffix' => 'suffix']
'type' => ['attribute' => ['attrName', 'attrValue']]
A usage Example of this column data type is the following:
Column Data Styles
Align
The Align
is used to change text direction of rows or columns of the grid, to create the Align
do the following:
or
If you set column type as Number
the text direction automatically will be changed to right
BackgroundColor
The BackgroundColor
is used to change background color of rows or columns of the grid, to create a BackgroundColor
do the following:
where the parameters are the color red green blue values.
To see how to apply style on rows or columns see the [Applying Style](#Applying Style) section.
Bold
The Bold
style simply make the text bold, you can create a bold style like this:
To see how to apply style on rows or columns see the [Applying Style](#Applying Style) section.
Color
The Color
is used to change the color of rows or columns of the grid, to create a Color
do the following::
where the parameters are the color red green blue values.
To see how to apply style on rows or columns see the [Applying Style](#Applying Style) section.
Italic
The Italic
style simply make the text italic, you can create an Italic style like this:
where the parameters are the color red green blue values.
To see how to apply style on rows or columns see the [Applying Style](#Applying Style) section.
Strikethrough
The Strikethrough
style simply make the text strikethrough, you can create a bold style like this:
To see how to apply style on rows or columns see the [Applying Style](#Applying Style) section.
CSSClass
The CSSClass
is used to set additional classes attribute of rows or cells of the grid, to create a CSSClass
do the following::
Applying Style
- Apply only when the value of the column :product_price: = 50
You can add multiple conditions for the style using ByValue
, and you can set the operator between the multiple conditions to be 'OR' or 'AND' like the following:
-
Apply only when the value of the column ':product_price:' between 20 and 40 (inclusive)
- Apply only when the value of the column ':order_quantity:' is greater or equal than the value of the column ':product_stock:'
Notice. This functionality is not full tested!
Column Data Formatters
Link
The Link formatters displays a column content as an HTML link with value and href is the column content, to use it do the following:
You also can pass Column object as 'placeholder_column'
The link formatter also support multiple placeholders for build url
Inline
Inline Formatter allow to show text in one line. This will be replace all <br>
, \n
and some other filtration for full
compatibility with jqGrid.
ExternalLink
ExternalLink Formatter allow use full URL without inner rawurlencode
preparation.
Preference is given to
Link Formatter
. Use in extreme cases.
DropDown in search panel
Simple
Just put array with options to filter_select_options
. Be carefully options are doubled wrapped with array.
Doctrine
filter_select_options
config is based on DoctrineModule
for Zend\Form
(some options need implementation).
DropDown in Edit Record
Doctrine
It's similar to filter_select_options
. column_select_options
adds dropdown with selected data to Edit Record form.
DatePicker in search panel
At this moment DatePicker require partial settings. You must carefully monitor the date formats.
Notice. Intl use default ISO date format (RFC 822). Detailed format explanation you can find in ZF documentation.
Grid Data Sorting
Default grid data sort can be set with sort_default
option.
ASC
sort order will be applied to column position
only if any other user filters did not apply before.
Also several default sort orders can be set, simply apply sort_default
to relative columns
Grid Data Filtering
Default grid data sort can be set with filter_default_operation
option.
like
filter will be applied by default if any other user filters did not apply before.
Notice! There is issue which don't allow apply filter from client side.
Buttons
Buttons Introduction
Custom buttons for ZfcDataGrid
.
Column Chooser
Object notation:
Config notation: