Class Gridedit

A widget based on the 'datagrid' that enhances it
with user interface to add, remove, and modify data entries.

Part of:

package weblocks, class datagrid

Direct Superclass

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


If true, gridedit provides the UI to add entries to the collection.
Initform:t, Initargs::allow-add-p; Accessors:gridedit-allow-add-p.
If true, gridedit provides the UI to delete entries in the collection.
Initform:t, Initargs::allow-delete-p; Accessors:gridedit-allow-delete-p.
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.
If set to true, mixin objects will be deleted from the store when the parent object is deleted. By default set to *default-cascade-delete-mixins-p*.
Initform:*default-cascade-delete-mixins-p*, Initargs::cascade-delete-mixins-p; Accessors:gridedit-cascade-delete-mixins-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.
Type of the drilldown UI to be provided by the gridedit. The default, :edit, provides a form via 'dataform' widget when the user drills down into a given item. If :view is specified the UI will provide a dataform in the view mode. You can also customize 'gridedit-create-drilldown-widget' to provide more fine grained behavior.
Initform:edit, Initargs::drilldown-type; Accessors:gridedit-drilldown-type.
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.
An optional custom data view that, if provided, is used to instantiate the 'item-widget'.
Initargs::item-data-view; Accessors:gridedit-item-data-view.
An optional custom form view that, if provided, is used to instantiate the 'item-widget'.
Initargs::item-form-view; Accessors:gridedit-item-form-view.
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 widget used by gridedit to display a form for adding and editing items. This widget will be created and destroyed as necessary.
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 function called by gridedit when an item is added. The function should accept two arguments (the gridedit object and a new item), and should take appropriate action. Note that the 'dataform' widget will persist the item to the store via the API.
Initargs::on-add-item; Accessors:gridedit-on-add-item.
A function called by gridedit when one or more items are deleted. The function should accept two arguments (the gridedit object and a value that has semantics similar to datagrid's 'selection' slot). If the function is missing, the item is deleted via store API.
Initargs::on-delete-items; Accessors:gridedit-on-delete-items.
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 state of the gridedit control. When set to nil, gridedit simply renders an 'add entry' button and a 'delete entry' button, assuming they are permitted (see 'allow-add-p' and 'allow-delete-p'). When set to :add, renders an empty form that allows adding a new entry. When set to :drilldown, renders details for a particular item.
Initargs::ui-state; Accessors:gridedit-ui-state.
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-pagination-widgetThis function is responsible for rendering the pagination widget
for the datagrid.
gridedit-add-itemIf 'on-add-item' is specified, simply calls
'on-add-item'. Otherwise, if 'data' is a sequence, ad...
gridedit-create-drilldown-widgetThe default implementation creates a dataform that allows editing
an existing entry. Specialize t...
gridedit-create-new-item-widgetThe default implementation creates a dataform that allows adding a
new entry. Note, in order for ...
gridedit-delete-itemCalled by 'gridedit-delete-items' to delete a single item. The
default implementation deletes the...
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

datagrid-render-mining-barThis function renders the data mining bad for the data
grid (including selection controls, search...
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...