-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Grid view #5990
Open
BurntimeX
wants to merge
44
commits into
6.2
Choose a base branch
from
grid-view
base: 6.2
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
dtdesign
reviewed
Sep 19, 2024
BurntimeX
force-pushed
the
grid-view
branch
from
September 30, 2024 11:56
47ab3ce
to
0b75b22
Compare
Gridview is no longer based on the tabularBox classes
This is intended to enable filtering by columns that are not displayed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Grid view is a generic solution for the creation of listings, as they occur again and again in the software. In addition to rendering, the grid view also take care of sorting, filtering and pagination and ensure that a lot of boilerplating becomes obsolete.
The implementation essentially offers the following advantages:
See #5967
Usage
CronjobLogGridView is available as a reference implementation.
DatabaseObjectListGridView
DatabaseObjectListGridView
allows to use aDatabaseObjectList
as the data source for the grid view.Example:
DataSourceGridView
DataSourceGridView
use an array as the data source for the grid view.Example:
AbstractGridViewPage
With the help of
AbstractGridViewPage
, grid views can be easily integrated into pages.Example:
Template:
Columns
Columns can be created using the
GridViewColumn::for
method. This expects a unique string as a parameter, which is equivalent to the corresponding key in the data source.The
label
method can be used to give the column a human readable label.Example:
Renderer
Renderers can be applied to columns to format the output. A column can have multiple renderers. The renderers are applied in the order in which they were set.
CurrencyColumnRenderer
CurrencyColumnRenderer
formats the content of a column as a currency. Expects the content of the column to be a decimal.Example:
DefaultColumnRenderer
The
DefaultColumnRenderer
is automatically applied to all columns if no other renderers have been set. It converts special characters to HTML entities.LinkColumnRenderer
LinkColumnRenderer
allows the setting of a link to a column.Example:
NumberColumnRenderer
NumberColumnRenderer
formats the content of a column as a number usingStringUtil::formatNumeric()
.Example:
PhraseColumnRenderer
PhraseColumnRenderer
formats the content of a column as a phrase.Example:
TimeColumnRenderer
TimeColumnRenderer
renders a unix timestamp into a human readable format.Example:
TitleColumnRenderer
TitleColumnRenderer
formats the content of a column as a title.Example:
Row Link
A row link applies a link to every column in the grid.
The constructor supports 3 optional parameters:
string $controllerClass
: The controller to which the link should refer.array $parameters
: Additional parameters for the controller.string $cssClass
: CSS class for the link.Sorting
Columns can be marked as sortable so that the user has the option of sorting according to the content of the column.
Default Sort Field
The default sort field and sort order can be set when building the grid view:
Filtering
Filters can be defined for columns so that the user has the option of filtering according to the content of the column.
I18nTextFilter
I18nTextFilter
is a filter for text columns that are using i18n phrasesExample:
SelectFilter
SelectFilter
allows a column to be filtered on the basis of a select dropdown.Example:
TextFilter
TextFilter
is a filter for text columns.Example:
TimeFilter
TimeFilter
is a filter for columns that contain unix timestamps.Example:
Actions
Actions
are actions that the user can apply to a row in the grid view. Typical use cases are deleting and editing.By default, actions are made accessible via a dropdown. Special actions are so-called “quick actions”, which can be controlled directly via their own icons.
DeleteAction
DeleteAction
allows the user to delete a row of the grid view. The constructor expects the RPC API endpoint for deletion as a parameter.Example:
EditAction
EditAction
adds a link to the corresponding edit form. The constructor expects the name of the controller as a parameter.Example:
ToggleAction
ToggleAction
allows the user to enable/disable a row of the grid view. The constructor expects the RPC API endpoints for enabling and disabling as parameters.Example:
Events
Existing grid views can be modified using events. Example of adding an additional column:
Planned Functions