Class Datagrid

Represents a sortable, pagable table. This
widget is inspired by ASP.NET's datagrid control.

Part of:

package weblocks, class gridedit, class widget

Direct Superclass

widgetBase class for all widget objects.

Direct Subclass

grideditA widget based on the 'datagrid' that enhances it
with user interface to add, remove, and modif...


If set to true and 'on-drilldown' isn't nil, datagrid provides the UI to drill down into items.
Initform:t, Initargs::allow-drilldown-p; Accessors:datagrid-allow-drilldown-p.
If true, datagrid provides UI to access operations defined in 'item-ops'.
Initform:t, Initargs::allow-item-ops-p; Accessors:datagrid-allow-item-ops-p.
Set to true to enable pagination (default) or nil to disable it.
Initform:t, Initargs::allow-pagination-p; Accessors:datagrid-allow-pagination-p.
Set to true to enable searching, or to nil to disable it.
Initform:t, Initargs::allow-searching-p; Accessors:datagrid-allow-searching-p.
If true, datagrid provides the UI to select entries in the collection.
Initargs::allow-select-p; Accessors:datagrid-allow-select-p.
If set to true, 'drilled-down-item' will be automatically set to the appropriate item when the user drills down on the grid.
Initargs::autoset-drilled-down-item-p; Accessors:datagrid-autoset-drilled-down-item-p.
Stores the continuation object for widgets that were invoked via one of the do-* functions ('do-page', etc.). When 'answer' is called on a widget, this value is used to resume the computation.
The class name of the objects rendered by this datagrid. While the class can potentially be obtained from the data directly, it is not always possible. Additionally, specifying the class makes datagrid more efficient. For these reasons it is required to specify this slot at the instantiation time.
Initargs::data-class; Accessors:datagrid-data-class.
If 'allow-drilldown-p' is set to true and the user drills down on an item this slot can be set to the item in question. The datagrid will then render the appropriate row with a 'drilled-down' class for CSS styling. This slot is set to the drilled down item automatically only when 'autoset-drilled-down-item-p' is true. Note, it is always the responsibility of the datagrid's client to reset this slot back to nil.
Initargs::drilled-down-item; Accessors:datagrid-drilled-down-item.
A flash widget provided by the datagrid to display relevant information to the user (errors, item modification information, etc.)
Initform:(make-instance 'flash), Initargs::flash; Accessors:datagrid-flash.
A list of cons cells that define operations on items. A car of each cell should contain a name of the operation, while the cdr of each cell should contain a function that accepts two arguments - the grid object, and the selection cons cell passed to the function for convenience. Any given function is called by the datagrid when the appropriate operation has been invoked by the user.
Initargs::item-ops; Accessors:datagrid-item-ops.
A name of the widget used in rendering CSS classes. If the name is not provided it will be generated automatically with 'generate-widget-id'.
Initform:(generate-widget-id), Initargs::name; Accessors:widget-name.
A cons cell that represents a drilldown operation. The car of the cell should contain symbol representing the name of the operation (i.e. 'details', 'edit', etc.) and the cdr of the cell should contain a function of two arguments (grid obj and item object). If this slot isn't set to nill and 'allow-drilldown-p' is true, datagrid provides the UI to drill down into items.
Initargs::on-drilldown; Accessors:datagrid-on-drilldown.
A function designator that accepts the grid instance, as well as searching, sorting, and pagination parameters. The function is expected to return a properly sorted and paged sequence. The function should also accept a :countp keyword argument. If true, the function should return only the number of items with the given search parameters, not the actual items themselves. If this slot is NIL (the default), the datagrid will operate on all persistent classes specified in 'data-class'.
Initargs::on-query; Accessors:datagrid-on-query.
An instance of a pagination widget used by the datagrid to manage data pagination.
Initargs::pagination-widget; Accessors:datagrid-pagination-widget.
A list of widget paths (see 'find-widget-by-path') or widgets each of which will be made dirty when this widget is made dirty via a POST request. This slot allows setting up dependencies between widgets that will make multiple widgets update automatically during AJAX requests.
Initargs::propagate-dirty; Accessors:widget-propagate-dirty.
This slot holds a boolean flag indicating whether the widget has been rendered at least once. Because marking unrendered widgets as dirty may cause JS problems, 'mark-dirty' will use this flag to determine the status of a widget.
When the user searches the datagrid, the current page is stored in this slot, to be restored when the user clears the search.
Contains a cons cell that identifies currently selected elements. That 'car' of the cell is either :all or :none. In case of :all, all items except the ones in the cdr list are selected. In case of :none, none of the elements except the ones in the cdr list are selected.
Initform:(cons none nil), Initargs::selection; Accessors:datagrid-selection.
If set to true (the default), the datagrid displays a message specifying how many items are visible. If searching is enabled, the message specifies how many items have been hidden by the search.
Initform:t, Initargs::show-total-items-count-p; Accessors:datagrid-show-total-items-count-p.
A mixin view to be used to render the field.
Initargs::view; Accessors:mixin-view-field-view.
A function called prior to rendering the widget body. The function should expect the widget as well as any additional arguments passed to the widget.
Initargs::widget-prefix-fn; Accessors:widget-prefix-fn.
A function called after rendering the widget body. The function should expect the widget as well as any additional arguments passed to the widget.
Initargs::widget-suffix-fn; Accessors:widget-suffix-fn.

Direct Method

datagrid-render-item-ops-barThis function is responsible for rendering item-ops bar for the
datagrid. Specialize this functio...
datagrid-render-mining-barThis function renders the data mining bad for the data
grid (including selection controls, search...
datagrid-render-pagination-widgetThis function is responsible for rendering the pagination widget
for the datagrid.
render-datagrid-table-bodyRenders the actual data of the datagrid without any controls
before or after. This function is us...
render-widget-bodyA generic function that renders a widget in its current state. In
order to actually render the wi...
widget-public-dependenciesWhenever a widget is rendered by weblocks in a non-AJAX request,
this function is called to deter...

Other Method

find-widget-by-path*Returns a widget object located at 'path', where 'path' is a list
of widget names starting from r...
mark-dirtyDefault implementation adds a widget to a list of dirty
widgets. Normally used during an AJAX req...
widget-css-classesReturns a string that represents applicable CSS
classes for 'widget'. Normally includes the class...