Added a Datagrid app to Djblets

Review Request #194 — Created Dec. 12, 2007 and submitted

Information

Navi (deprecated)
trunk

Reviewers

Added a new Datagrid app to Djblets. This is a flexible component for creating grids of data, similar to what's possible with an object_list but allowing custom columns and sorts.

The basic design is that apps wishing to display data in a grid will subclass the DataGrid. The subclass will contain a bunch of class variables representing Column instances. These Columns determine both the header for the column and render the data for the cell.

The default Column class is very flexible, allowing for a text and/or image-based header, cell data provided by a database field in the object or the result of a function, custom CSS (by name or result of a function), shrink/expand options, a sortable flag, and link information for linking the data to an object or some other page.

Columns can be subclassed to provide special behavior, such as custom rendering of data. Two useful examples of this are provided for rendering timestamps in both absolute and relative form.

The DataGrids can retrieve and store user-specified sort orders and columns in the profile. This is done in a generic way, allowing it to work with any Django app setup and any profile. Subclasses can provide additional variables for the datagrid that can be loaded and saved.

This is in no way tied to Review Board, but it's being used by Review Board to replace all the specific templates for the various lists and the dashboard. The result is a lot of code cleanup. This will be in a separate review request.
Tested with my Review Board change. Column customizations and sort orders are properly loaded and saved in the profile and can be changed on the URL via the sort and columns parameters. Every view works as expected.
david
  1. I can't see anything here I don't like!
  2. 
      
Loading...