Register to post in forums, or Log in to your existing account
 

 Related 
Contents
Common Properties:
  Name *
  Left *
  Top *
  Width *
  Height *
  Align *
  AutoLeft *
  AutoTop *
  DeltaLeft *
  DeltaTop *
  DeltaRight *
  DeltaBottom *
  AutoCenter *
  FullWidth *
  AutoSize
  Visible
  DataSource
Visual Object Reference
  Common Properties
  Common Events
  ActiveX
  Button
  Checkbox
  CheckGroup
  ColorBtn
  Column
  Combo
  Dock
  Edit
  Grid
    Data
    ClearSorting
    DataChanged
    Clear
    Columns
    ShowHeader
    RowCount
    CurRow
    Collection
    ListStyle
    Row
    Col
    Style
    View
    ColCount
    CurCell
    ShowIndicator
    ShowGroupBox
    ShowFilterBox
    AutoWidth
    AutoFit
    GridLines
    GridLineColor
    Column
    Cell
    RowHeight
    ColWidth
    DefKind
    Editing
    InvertSelect
    DefEdit
    MultiSelect
    CellMultiSelect
    HideSelection
    AddColumn
    DeleteColumn
    CellSelect
    OnCellClick
    ExportToExcel
    ExportToHTML
    ExportToXML
    ExportToText
  Group
  Image
  Item
  ItemSep
  Label
  List
  Memo
  Menu
  Navigator
  Node
  Page
  Pages
  Panel
  RadioGroup
  Ruler
  SpinEdit
  Splash
  Splitter
  StatusBar
  Style
  Tab
  Tabs
  Toolbar
  Tree
  Window
Related Links:
  DataSource
  Column
  Connection
  Grid
  Clear
  Collection
  GridLines
  Collection
  MaxRecords
  Style
Grid [[zGrid]] 
NOTE: This Design document is subject to change at any time.

Syntax: <GRID property-list>columns</GRID>

The GRID component is one of the most complex and flexible controls available in zApp. It is based upon the industry leading Developer Express QuantumGrid component and provides more functionality than most any other grid control available.

The zApp Grid component can be either bound to a database query, or bound to a simple zCollection of data. If can even be bound to a one-dimensional or two-dimensional array in your scripting language.

No matter what data source is used, the grid component provides automatic sorting, filtering, and grouping capabilities. Columns can be reordered or resized. And the data in the grid can be edited with a variety of different inplace editors.

Using a Grid is as simple as assigning an array to it. For example:
Code:
dim A(3,10)
Grid.Data = A

would create an editable grid with 3 columns and 10 rows. This Column,Row order for arrays is used to take advantage of the efficient way in which scripting languages such as VBScript can redimension a virtual array quickly when just changing the last dimension (the row dimension in zApp).

When an array is assigned to a grid, any change made to the grid is automatically made to the data in the array. If the array is changed within the script, the grid can be updated to reflect the new data using the DataChanged method of the grid.

A grid can also be used for a simple list, or to display the contents of a Collection object. For example:
Code:
<GRID Name='Grid' Columns='Filename|Size'/>
<SCRIPT>
  set Files = file.findfiles( "C:\Windows\*.*")
  Grid.Data = Files
</SCRIPT>
would create a grid with two columns, "Filename" and "Size". The file.findfiles function is used to quickly return a collection of file objects from the given path. This collection is then assigned to the grid. By default, the caption for the columns is used as the COM object property name to fetch data from the collection. This can be changed using actual zColumn objects as described later.

To connect a Grid to a database, simply assign a zDataSource to the grid. For example:
Code:
<CONNECTION Filename='northwind.mdb'>
  <QUERY SQL='SELECT * FROM Employees'>
    <DATASOURCE Name='Northwind'/>
  </QUERY>
</CONNECTION>
<GRID Datasource='Northwind'/>

would display a grid showing all fields and records in the Employees table of the Northwind.mdb database.

The columns in the grid can be customized by creating zColumn objects within the grid. This allows the Field name to be different from the caption and allows you to control many properties of the individual columns.
Viewer Comments [0 - Post your comments]

Jump to:  

© 2009 Zugg Software. Hosted by Wolfpaw.net