develop faster.

PlatinumGrid has an extremely simple and flexible API. This allows developers to begin using PlatinumGrid very quickly, and allows them to access even advanced features with ease. This page demonstrates this easy-to-use API.

PlatinumGrid ships with over 30 examples covering virtually all features of the grid, that provide a simple and effective way of showing how to use the API. We've taken a few of these examples to convey some idea of the simplicity of using PlatinumGrid in any PHP application.

Note. For applications written using RadPHP, PlatinumGrid is a drag-and-drop component with complete integration into the RPCL. This page is intended for the developers who do not use RadPHP.

To persist the grid state during the session is easy. All one has to do is call the grid's serialize and unserialize methods to write/read the grid's state into the session.
// This demo demonstrates how to store the grid's settings in the session, so that
// sorting, grouping and the other grid settings are preserved between requests.
require_once( '' );

// Start the session. This tells PHP that we want to use the session, and also
// loads any previously saved data into the $_SESSION global variable.

// Connect to the database and load the table.
$dbConnection mysql_connect'localhost''root''' );

mysql_select_db'gridsamples'$dbConnection );

$dataSource = new MySQLDatasource$dbConnection );
$dataSource->DataSet->TableName 'employeestiny';

// Construct the grid, supplying a few default settings.
$grid = new JTPlatinumGrid();
$grid->Datasource $dataSource;
$grid->Height '';
$grid->SiteTheme->Theme 'default';

// This if statement checks if the grid exists in the session and if it does not,
// then it creates the various default settings on the grid. It also allows the session
// state to be reset by supplying restore_session=1 on the query string.
if( !isset( $_SESSION'sid' ] ) || $_GET'restore_session' ] == '1' )
// The session has not been created, or is being reset, so we set the properties
    // on the grid.
$grid->CanRangeSelect false;
$grid->Header->ShowFilterBar false;
$grid->Height 540;
$grid->Width 955;

// And create the columns.
$textCol1 = new JTPlatinumGridTextColumn$grid );
$textCol1->Caption 'First Name';
$textCol1->DataField 'FirstName';
$textCol1->Name 'FirstNameCol';

$textCol2 = new JTPlatinumGridTextColumn$grid );
$textCol2->Caption 'Last Name';
$textCol2->DataField 'LastName';
$textCol2->Name 'LastNameCol';

$textCol3 = new JTPlatinumGridTextColumn$grid );
$textCol3->Caption 'Department';
$textCol3->DataField 'Department';
$textCol3->Name 'DepartmentCol';

$grid->Columns = array( $textCol1$textCol2$textCol3 );
// The session has been created, so we just have to tell the grid to load
    // its state from the session.

// Tell the grid to initialize.
  <title>Basic Persistence Demo</title>
  <h1>Basic Persistence Demo</h1>
  <form action="" method="post">
    <div id="<?php echo( $grid->Name ); ?>_outer">
<?php $grid->dumpContents(); ?>
    <input type="submit" value="Click to refresh page" />

// Now, we tell the grid to write its state into the session. This will store all
// settings such as sorting, grouping etc.

// Now we store our own variable in the session, so we can tell if the session
// has been created. This variable is used by the if statement above.
$_SESSION'sid' ] = 1;