This bugtracker is archived (announcement). New tickets are created on github.com. See all framework issues, cms issues, and search the module listings for more specific bugtrackers.
wiki:development/DataGrid
Last modified 3 years ago Last modified on 18/05/11 08:55:25

Data Grid UI component Proposal

This page collects features and issues around a new DataGrid class which will replace TableListField? and various subclasses in SilverStripe? 3.

Goals

  • Effective usage of new ORM (lazy loading, filter syntax)
  • Composition over inheritance to extend functionality
  • Flexible view options: Table and grid
  • JS library agnostic, but easy integration and useful defaults
  • Unobtrusive base functionality (sorting, filtering, pagination), but reliant on JS for more advanced features
  • Replace most of ModelAdmin?: Built-in CRUD for DataObjects? and relationships
  • Flexible data display: Defaults to HTML, but allows for other data formats

Features: View

  • Table view, grid view
  • Pagination
  • Column definition
  • Column sorting
  • Field casting (e.g. "$MyDate?.Nice")
  • Field formatting (e.g. "My date label: $MyDate?")
  • Field value traversal (e.g. $Author.FirstName? to view a has_one)
  • Adapters for client libraries (configuration templates for JS, incl. casting)

Features: Filtering

  • Uses ORM filtering and DataObject? search defininitions
  • Flexible filter form view: Compact search bar vs. custom scrollable sidebar
  • Serializable state (browser history, sharing links): GET parameters or JSONQuery
  • Work within existing form DOM element, namespacing search form fields to avoid collisions

Features: CRUD

  • "Add" and "edit" forms through DataObject? scaffolding (rather than
  • Actions on single item, and batch actions on selected items. Defaults to "delete", but can be extended e.g. by workflow.

Should use the same commands for single and batch actions.

Features: Relations

  • Limit results to a has_many/many_many relationship
  • Add a relationship by searching for an item
  • Remove a relationship through row-based actions (instead of removing the item)

Potential Features

  • Data Import(based on CSVBulkLoader and other implementations?)
  • Sortable rows (mainly for relationships with a "Sort" column)
  • Data export (through a new interface hooking into DataFormatter??)
  • Usage through RestfulServer
  • Custom collections rather than DataObject? instances (for reporting based on complex SQL)
  • Tree grid
  • Edit many_many_ExtraFields

Out of scope

  • Unobtrusive inline editing (a.k.a. TableField?). JS driven inline editing depends on library capabilities, probably won't use SS form fields
  • Grouping of rows: Use a JS library instead
  • Totals/subtotals: Use a JS library instead
  • View/edit external data sources (not DataObject? based), use JS library without going through SS PHP components.

Existing SilverStripe? modules

Existing JS libraries

Existing PHP/server-side components

Questions

  • Build default CRUD layer on jQuery UI dialog, replaced in CMS UI with custom panel interface?
  • Grouping support only through RestfulServer? How do we represent grouped records, as they're no longer DataObjects??
  • RestfulServer support for non-HTTP verbs like "unpublish", or custom controller actions only?
  • Assuming tree and grid views are interchangeable, how do we unify existing (tree-based) CMSBatchAction commands and generic DataGrid commands?
  • Serialize state via JSONQuery or GET parameters?
  • How do we convert between custom definitions of SearchFilter/SearchContext? and JSONPath (e.g. JSONPath allows greater-than/less-than syntax, but in PHP we have to define a GreaterThanField? specifically)
  • Contain whole field in iframe to provide true form separation? (meaning a paging request wouldn't need to submit/render the entire form, incl. all unrelated fields)