
Utilities: Grid columns
Configuring columns in MiniShop3 admin tables.
Purpose
The tool configures columns in admin grids (tables):
- Enable and disable columns
- Change column order
- Configure sorting and filtering
- Set column width
- Add custom columns
Available grids
| Grid | Description |
|---|---|
customers | Customer list |
orders | Order list |
products | Products in category (category-products) |
order_products | Products in order |
vendors | Vendor list |
Interface
Grid selection
Select a grid from the dropdown at the top of the page.
Columns table
Shows current column configuration:
| Column | Description |
|---|---|
| Name | System field name |
| Label | Display header |
| Visible | Show column |
| Sortable | Allow sort on click |
| Filter | Show filter |
| Frozen | Fix on horizontal scroll |
| Width | Width in pixels |
Actions
- Drag — reorder columns
- Edit — click row to open dialog
- Add — button to create new column
Column parameters
Basic
| Parameter | Description |
|---|---|
| Field name | Model field name or alias |
| Label | Column header |
| Visible | Show column |
| Sortable | Allow sort on click |
| Filterable | Show filter field |
| Frozen | Fix on scroll |
Sizes
| Parameter | Description |
|---|---|
| Width | Width in px or % |
| Min width | Minimum width when resizing |
Column type
| Type | Description |
|---|---|
model | Field from data model |
template | Template column (HTML) |
relation | Data from related table |
computed | Computed value |
image | Image display |
boolean | Yes/No flag |
actions | Actions column |
Column types
Model
Standard column showing a field value.
Type: model
Field: email
Label: EmailTemplate
Column with HTML template.
Type: template
Template: <a href="mailto:{email}">{email}</a>Variables — current row fields in curly braces.
Relation
Data from related table.
Relation parameters:
| Parameter | Description |
|---|---|
| Table | Related table name |
| Foreign key | Link field |
| Display field | Field to show |
| Aggregation | COUNT, SUM, AVG, MIN, MAX |
Example — customer order count:
Type: relation
Table: msOrder
Foreign key: customer_id
Aggregation: COUNTComputed
Value computed on server by a custom class.
Type: computed
Class: MyComponent\Columns\TotalSpentColumnImage
Image thumbnail.
Type: image
Field: imageBoolean
Yes/No flag with icon.
Type: boolean
Field: activeActions
Column with action buttons. Supports built-in and custom handlers.
Action config:
[
{
"name": "edit",
"handler": "edit",
"icon": "pi-pencil",
"label": "Edit",
"severity": null
},
{
"name": "delete",
"handler": "delete",
"icon": "pi-trash",
"label": "Delete",
"severity": "danger",
"confirm": true,
"confirmMessage": "Are you sure you want to delete this record?"
}
]Built-in handlers:
| Handler | Description |
|---|---|
edit | Open record for edit |
delete | Delete record |
view | View record |
addresses | Manage addresses (customers) |
refresh | Refresh grid |
Examples
Hide column
- Find the column in the list
- Uncheck "Visible"
- Click "Save"
Add "Total orders" column
- Click "Add column"
- Fill:
- Name:
total_spent - Label:
Total orders - Type:
relation - Table:
msOrder - Foreign key:
customer_id - Display field:
cost - Aggregation:
SUM
- Name:
- Save
Change column order
Drag columns into the desired order.
Add link in email column
- Find column
email - Change type to
template - Set template:
<a href="mailto:{email}">{email}</a> - Save
API Endpoints
Get grid config
GET /api/mgr/grid-config/{grid_name}Save config
PUT /api/mgr/grid-config/{grid_name}Reset to default
DELETE /api/mgr/grid-config/{grid_name}System columns
Some columns are system columns and cannot be deleted or have their field name changed; they can only be hidden. Usually id and action columns.
Custom actions
MiniShop3 provides the global MS3ActionRegistry to add custom buttons to the actions column.
Registry API
register(name, handler, options)— register handlerregisterBeforeHook(actionName, hook)— run before actionregisterAfterHook(actionName, hook)— run after actionhas(name),get(name),unregister(name)execute(name, data, context)— run action programmatically
Icons
Use PrimeIcons. Examples: pi-pencil, pi-trash, pi-eye, pi-copy, pi-download, pi-send, pi-lock, pi-unlock, pi-ban, pi-check, pi-times, pi-refresh, pi-cog, pi-print, pi-external-link.
