J6/Grid/Virtual

From J Wiki
Jump to: navigation, search
J6/Grid | Data Options Types | Actions Events Methods | Class DerivedClass | Hierarchical MultiDimensional MultiLine Virtual | Examples

In a virtual grid, values are passed to the grid display as required, otherwise the grid operates like a normal grid.

A virtual grid is indicated by noun GRIDVIRTUALMODE. When this is set to 1, the CELLDATA values passed to the grid can be a subset of the total values.

The noun CELLRANGE should be given, to indicate the total data size. This is the maximum indices into the columns and rows, thus:

CELLRANGE=: <: |. $ total_data

The grid values are obtained by verb get. The default get (i.e. get_jzgrid_ ) signals a get event. Thus you can either create a get verb to override the default, or else write an event handler that handles the get event.

Verb get is called as:

get row_indices;col_indices

The result is a package that must contain CELLDATA, and can contain other nouns.

Note that if the grid is editable, then you need to read any changes to CELLDATA before giving new values to the grid. This can be done either through a change event handler, or by reading CELLDATA at the beginning of the get verb or event handler.

For an example using a custom get verb, see the jvgrid class, and the demo grid|Gallery|Virtual Countries that uses this class. For an example using a get event handler, see script system/examples/demo/vgriddemo.ijs.