Download the PHP package patricknelson/silverstripe-gridfieldlimititems without Composer
On this page you can find all versions of the php package patricknelson/silverstripe-gridfieldlimititems. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download patricknelson/silverstripe-gridfieldlimititems
More information about patricknelson/silverstripe-gridfieldlimititems
Files in patricknelson/silverstripe-gridfieldlimititems
Package silverstripe-gridfieldlimititems
Short Description Simple component which automatically limits the maximum number of items displayed in a GridField (including modifying actual relations).
License MIT
Informations about the package silverstripe-gridfieldlimititems
silverstripe-gridfieldlimititems
Simple component which automatically limits the maximum number of items displayed in a GridField (including modifying actual relations).
Important: This works well as a centralized method to maintain an actual hard limit on the number of has_many
and
many_many
relations. Therefore, this will modify those relations and doesn't (yet) simply limit the number of items displayed in a grid field.
Installation
- Run
composer require patricknelson/silverstripe-gridfieldlimititems
- Run
sake dev/build
Example Usage
Quick Start
Start managing a relation using the GridFieldConfig_LimitedRelationEditor
like so:
You can setup extra configuration options as well (most options have been included):
Warning: Since this will modify a relation as a component, it's best to ensure that the relation itself is not being
modified by any other components, such as a paginator. If you are using the standard GridFieldConfig_RelationEditor
you
will need to remove that component. For example:
Known Issues
- This could be vulnerable to issues relating to not runing in the proper order, in case you are sorting fields and the
newly sorted field is not yet properly intialized (e.g. starts out at 0 but should be set to 11 prior to modification).
In this scenario, you should be sure that your sorting component is added to the grid configuration PRIOR to this
component so that the sort can process first and then the pruning performed by this component can be done. This should
only be an issue if you are not using the built-in
GridFieldConfig_RelationEditor
which already ensures that it will process the relation last.
To Do
- Setup ability to customize notes.
- Setup the ability to modify the returned list without actually affecting relations (i.e. read only, no writing at all to the database).
- Unit tests to cover current functionality.