The fastest easiest way to get it right.

Making a Very Simple Grid

The Andromeda grid is useful for very simple scrollable lists. To make a grid that lists something, you follow these steps:

  1. Create the grid.
  2. Define the columns
  3. Load the Data
<?php
class x6example extends androX6 {
    function x6main() {
        # Always begin with this:
        $top = html('div');
        $top->addClass('fadein');
        
        #  ...other html is added here...
        #
    
        # Now for the grid create command.  The parameters are:
        # 1) Height
        # 2) Table we are editing
        # 3) Flag for lookup textboxes, no in this case
        # 4) Flag for sortable.  No
        # 5) Flag for buttonbar, No, not editable
        # 6) Flag for editable, no
        $grid = $top->addGrid(hSize(300),'states','N','N','N','N');
        
        # Now add a single column, take it from the
        # data dictinoary, that is always easiest
        $dd = ddTable('songs');
        $grid->addColumn($dd['flat']['songname']);
        $grid->lastColumn();
        
        # Now pull the data and add it.  Note that we
        # pull the 'skey' column so the grid has a
        # unique ID for each row.
        $view = ddtable('songs');
        $sq="select skey,songname from $view";
        $rows = SQL_AllRows($sq);
        $grid->addData($rows);
        
        
        # ...and this is always at the end
        $top->render();
    }
}

This code produces a scrollable read-only grid with a list of songs in it. The grid will be 300px high in 1024x768, and it will be scaled appropriately in other skin sizes.

User Comments

There are no user comments yet on this page.


Add A Comment

Comments will not appear until after they are moderated. Comments are usually moderated within a few hours on weekdays, but may take longer on weekends and holidays.

Name or nickname: (This will appear with your comment)


Email (this will never be displayed)


Enter your comment here. Use [b] and [/b] for bold, [i] and [/i] for italic, and [pre] and [/pre] for code samples. All literal HTML and PHP that you enter will be escaped out and displayed as you enter it.


Home |  Documentation |  Download |  Credits |  Contact |  Login
Andromeda © Copyright 2004-2010, Licensed under the GPL Version 2