Generic FunctionPackage: cgToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.1
Moderately revised from 8.0.
8.0 version

data-reader

Arguments: grid-column

Returns (or sets with setf) a function that retrieves the value to be displayed in a grid cell. This function is called by the default read-cell-value method, and supplying a data-reader function and a data-object function is an alternative to writing your own read-cell-value method. The data-reader may be nil if this facility is not used. The default value is nil.

The data-reader function is a property of a grid-column, and is called once for each grid-row that intersects that column to find the value to be displayed in the cell at that intersection. The function should take a single argument, which is the grid-row's data-object. The function is typically simply the reader function of the data-object for the attribute represented by this grid-column. If this column is accessing a slot that has no writer function or the writer function is not known, then the data-slot property could be used instead.

For example, in the employee grid example, each row represents an employee, and the Department column represents the department attribute of each employee. The data-reader function of the Department column is employee-department, which is simply the reader method for the department slot of an employee instance. To find the value to represent in the Department column for each employee, the Department column's data-reader function (employee-department) is called on the data-object (an employee) of each grid-row. The employee grid example can be found on the Examples tab of the Navigator.

NOTE: Your application typically will not call the data-reader function, and instead will supply the data-reader function which is then called automatically by the system as needed. Specifically, the built-in column classes such as editable-text-column-mixin will call the data-reader whenever they draw a cell, and a custom draw-cell method that an application supplies may call the default read-cell-value method, which calls the data-reader. Otherwise the draw-cell method may use some custom technique to find the value to draw, and a data-reader method is not needed at all.

data-reader is a property of the grid-column and row-header-column classes.

See the grid-widget class for an overview of writing grid-widget code.


Copyright (c) 1998-2009, Franz Inc. Oakland, CA., USA. All rights reserved.
This page has had moderate revisions compared to the 8.0 page.
Created 2007.4.30.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.1
Moderately revised from 8.0.
8.0 version