Skip to content

Latest commit

 

History

History
39 lines (28 loc) · 1.92 KB

gridfield-orderable.md

File metadata and controls

39 lines (28 loc) · 1.92 KB

GridField Orderable support

Considerations & Warnings

If you are using symbiote/silverstripe-gridfieldextensions and the GridFieldOrderableRows component:

  • GridFieldOrderableRows will have out of the box support for KFC for Versioned DataObjects, as it already uses the ORM and the write() method to save sort orders.
  • GridFieldOrderableRows unfortunately does not use the write() method for non Versioned DataObjects, it instead performs raw SQL queries, which completely bypasses the triggers we have attached to write().

There is an open ticket on the GridFieldExtensions module to try and get GridFieldOrderableRows to use the ORM for both Versioned and non-Versioned DataObjects: symbiote/silverstripe-gridfieldextensions#335

In the meantime though, we have provided an Extension that adds support for clearing of CacheKeys on non Versioned DataObjects when you are using the GridFieldOrderableRows component.

  • GridFieldOrderableRowsExtension

This Extension is not automatically applied, because I think you should seriously consider Versioning your DataObject. If you are adding this DataObject to (something like) an Element, which is Versioned, then (imo) it is best that all of the related DataObjects (like its "Items") are also Versioned. This gives a consistent author experience - where they can have draft/live versions of things.

This Extension also doesn't have any test coverage (because of everything we mentioned above). It has only gone through manual testing. Use at your own risk and be prepared to submit tickets if you find any issues or use cases that aren't supported.

Applying the Extension

Symbiote\GridFieldExtensions\GridFieldOrderableRows:
  extensions:
    - Terraformers\KeysForCache\Extensions\GridFieldOrderableRowsExtension