Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add PositionUpdater component doc, and update columns references docs
- Loading branch information
1 parent
d471359
commit 04ad976
Showing
14 changed files
with
523 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/content/1.7/development/components/grid/columns-reference/badge.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
title: BadgeColumn reference | ||
menuTitle: BadgeColumn | ||
weight: 10 | ||
--- | ||
|
||
# BadgeColumn Type | ||
{{< minver v="1.7.6" title="true" >}} | ||
|
||
This basic BadgeColumn displays a raw field data in Grid, associated with a badge. | ||
|
||
## Available options | ||
|
||
| Properties | Type | Expected value | | ||
| -------------- | ------ | ---------------------------------------------------------------------------------- | | ||
| **field** | string | **required** Record field name which column displays. | | ||
| **badge_type** | string | **default:** `success` Indicates which field of the row contains the image source. (*Allowed values:* `success, info, danger, warning`) | | ||
|
||
## Example usage | ||
|
||
```php | ||
use PrestaShop\PrestaShop\Core\Grid\Column\Type\Common\BadgeColumn; | ||
use PrestaShop\PrestaShop\Core\Grid\Column\ColumnCollection; | ||
|
||
$badgeColumn = new BadgeColumn('total_spent'); | ||
$badgeColumn->setName('Sales'); | ||
$badgeColumn->setOptions([ | ||
'field' => 'total_spent', | ||
'badge_type' => 'success', | ||
'empty_value' => '--', | ||
]); | ||
|
||
$columns = new ColumnCollection(); | ||
$columns->add($badgeColumn); | ||
``` |
21 changes: 10 additions & 11 deletions
21
src/content/1.7/development/components/grid/columns-reference/bulk-action.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,32 @@ | ||
--- | ||
title: BulkActionColumn reference | ||
menuTitle: BulkActionColumn | ||
weight: 60 | ||
weight: 20 | ||
--- | ||
|
||
# BulkActionColumn Type | ||
{{< minver v="1.7.5" title="true" >}} | ||
|
||
This type of column allows to add bulk action checkboxes to your Grid. | ||
This type of column allows to add bulk action checkboxes to your Grid. This only add the checkbox in the grid, you can then manage bulk actions via javascript. | ||
|
||
## Available options | ||
|
||
### field | ||
|
||
**bulk_field:** `string` **required** | ||
|
||
Record field name which will be used as bulk action checkbox value. | ||
| Properties | Type | Expected value | | ||
| -------------- | ------ | --------------------------------------------------------------------------------- | | ||
| **bulk_field** | string | **required:** Record field name which will be used as bulk action checkbox value. | | ||
|
||
## Example usage | ||
|
||
```php | ||
use PrestaShop\PrestaShop\Core\Grid\Column\Type\Common\BulkActionColumn; | ||
use PrestaShop\PrestaShop\Core\Grid\Column\ColumnCollection; | ||
|
||
$productColumn = new BulkActionColumn('bulk_action'); | ||
$productColumn->setName(''); // it is common set empty name for bulk action columns | ||
$productColumn->setOptions([ | ||
$bulkActionColumn = new BulkActionColumn('bulk_action'); | ||
$bulkActionColumn->setName(''); // it is common set empty name for bulk action columns | ||
$bulkActionColumn->setOptions([ | ||
'bulk_field' => 'id_product', | ||
]); | ||
|
||
$columns = new ColumnCollection(); | ||
$columns->add($productColumn); | ||
$columns->add($bulkActionColumn); | ||
``` |
11 changes: 5 additions & 6 deletions
11
src/content/1.7/development/components/grid/columns-reference/data.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 10 additions & 16 deletions
26
src/content/1.7/development/components/grid/columns-reference/datetime.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,35 @@ | ||
--- | ||
title: DateTimeColumn reference | ||
menuTitle: DateTimeColumn | ||
weight: 70 | ||
weight: 10 | ||
--- | ||
|
||
# DateTimeColumn Type | ||
{{< minver v="1.7.5" title="true" >}} | ||
|
||
You can use this column type in your Grid to format datetime values. | ||
It is common to get datetime value (e.g. Created at, Updated at & etc.) from database and format them before displaying. | ||
|
||
## Available options | ||
|
||
### field | ||
|
||
**type:** `string` **required** | ||
|
||
Field name which has datetime value. | ||
|
||
### format | ||
|
||
**type:** `string` **default:** `Y-m-d H:i:s` | ||
|
||
Format to use when formatting datetime. | ||
| Properties | Type | Expected value | | ||
| ----------- | ------ | ------------------------------------------------------------------ | | ||
| **field** | string | **required** Record field name which column displays. | | ||
| **format** | string | **default:** `Y-m-d H:i:s` Format to use when formatting datetime. | | ||
|
||
## Example usage | ||
|
||
```php | ||
use PrestaShop\PrestaShop\Core\Grid\Column\Type\Common\DateTimeColumn; | ||
use PrestaShop\PrestaShop\Core\Grid\Column\ColumnCollection; | ||
|
||
$column = new DateTimeColumn('datetime'); | ||
$column->setName('Created at'); | ||
$column->setOptions([ | ||
$dateTimeColumn = new DateTimeColumn('datetime'); | ||
$dateTimeColumn->setName('Created at'); | ||
$dateTimeColumn->setOptions([ | ||
'field' => 'date_add', // field name that has datetime value | ||
'format' => 'Y/d/m H:i:s', // define custom format for datetime | ||
]); | ||
|
||
$columns = new ColumnCollection(); | ||
$columns->add($column); | ||
$columns->add($dateTimeColumn); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/content/1.7/development/components/grid/columns-reference/image.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
title: ImageColumn reference | ||
menuTitle: ImageColumn | ||
weight: 10 | ||
--- | ||
|
||
# ImageColumn Type | ||
{{< minver v="1.7.6" title="true" >}} | ||
|
||
This column is used to display an image from a row. You need to specify which field of the row contains the image source. | ||
|
||
## Available options | ||
|
||
| Properties | Type | Expected value | | ||
| ------------- | ------ | ----------------------------------------------------------------------- | | ||
| **src_field** | string | **required** Indicates which field of the row contains the image source | | ||
|
||
## Example usage | ||
|
||
```php | ||
use PrestaShop\PrestaShop\Core\Grid\Column\Type\Common\ImageColumn; | ||
use PrestaShop\PrestaShop\Core\Grid\Column\ColumnCollection; | ||
|
||
$imageColumn = new ImageColumn('flag'); | ||
$imageColumn->setName('Flag'); | ||
$imageColumn->setOptions([ | ||
'src_field' => 'flag', | ||
]); | ||
|
||
$columns = new ColumnCollection(); | ||
$columns->add($imageColumn); | ||
``` |
38 changes: 38 additions & 0 deletions
38
src/content/1.7/development/components/grid/columns-reference/link.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
title: LinkColumn reference | ||
menuTitle: LinkColumn | ||
weight: 10 | ||
--- | ||
|
||
# LinkColumn Type | ||
{{< minver v="1.7.6" title="true" >}} | ||
|
||
This LinkColumn displays a raw field data encapsulated in a link (very useful to add an edition link on a name for example). | ||
|
||
## Available options | ||
|
||
| Properties | Type | Expected value | | ||
| -------------- | ------ | ---------------------------------------------------------------------------------- | | ||
| **field** | string | **required** Record field name which column displays. | | ||
| **route** | string | **required** Route used to generated link url. | | ||
| **route_param_name** | string | **required** Parameter name used by the route to generate the url. | | ||
| **route_param_field** | string | **required** Record field containing the route parameter. | | ||
|
||
## Example usage | ||
|
||
```php | ||
use PrestaShop\PrestaShop\Core\Grid\Column\Type\Common\LinkColumn; | ||
use PrestaShop\PrestaShop\Core\Grid\Column\ColumnCollection; | ||
|
||
$linkColumn = new LinkColumn('total_spent'); | ||
$linkColumn->setName('Sales'); | ||
$linkColumn->setOptions([ | ||
'field' => 'name', | ||
'route' => 'admin_category_edit', | ||
'route_param_name' => 'categoryId', | ||
'route_param_field' => 'id_category', | ||
]); | ||
|
||
$columns = new ColumnCollection(); | ||
$columns->add($linkColumn); | ||
``` |
Oops, something went wrong.