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.

PlatinumGrid supports the calculation and display of column summaries at both the group and grid levels. Supported aggregate functions are: Average, Count, Maximum, Minimum and Sum. To enable a particular column summary, just set the corresponding property on the column to true.
"." );

'../' );

$dbConnection mysql_connect'localhost''root''' );

mysql_select_db'gridsamples'$dbConnection );

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

// Construct the grid.
$grid = new JTPlatinumGrid();
$grid->Datasource $dataSource;
$grid->GroupBy 'CustomerID ASC';
$grid->Height '';
$grid->OnRowData 'rowData';
$grid->OnSummaryData 'summaryData';
$grid->SiteTheme->Theme 'default';

$salesOrderIDCol = new JTPlatinumGridTextColumn$grid );
$salesOrderIDCol->Caption 'SalesOrderID';
$salesOrderIDCol->DataField 'SalesOrderID';
$salesOrderIDCol->Name 'SalesOrderIDCol';
// Enable the summary.
$salesOrderIDCol->GroupSummary->ShowCount true;
$salesOrderIDCol->Summary->ShowCount true;

$customerIDCol = new JTPlatinumGridTextColumn$grid );
$customerIDCol->Caption 'CustomerID';
$customerIDCol->DataField 'CustomerID';
$customerIDCol->Name 'CustomerIDCol';

$subTotalCol = new JTPlatinumGridTextColumn$grid );
$subTotalCol->Caption 'SubTotal';
$subTotalCol->DataField 'SubTotal';
$subTotalCol->Name 'SubTotalCol';
// Enable the summary.
$subTotalCol->Summary->ShowAvg true;
$subTotalCol->Summary->ShowSum true;

$totalCol = new JTPlatinumGridTextColumn$grid );
$totalCol->Caption 'Total';
$totalCol->DataField 'Total';
$totalCol->Name 'TotalCol';
// Enable the summary.
$totalCol->GroupSummary->ShowAvg true;
$totalCol->GroupSummary->ShowSum true;
$totalCol->Summary->ShowSum true;

$grid->Columns = array( $salesOrderIDCol$customerIDCol$subTotalCol$totalCol );


rowData$sender$params )
$rowIndex $params];
$fieldValues = &$params];

    if( isset( 
$fieldValues'SubTotal' ] ) )
$fieldValues'SubTotal' ] = '$' number_format$fieldValues'SubTotal' ], );

    if( isset( 
$fieldValues'Total' ] ) )
$fieldValues'Total' ] = '$' number_format$fieldValues'Total' ], );

summaryData$sender$params )
$columnIndex $params];
$column $params];
$columnAggregates = &$params];

    if( isset( 
$columnAggregates'Avg' ] ) )
$columnAggregates'Avg' ] = '$' number_format$columnAggregates'Avg' ], );

    if( isset( 
$columnAggregates'Sum' ] ) )
$columnAggregates'Sum' ] = '$' number_format$columnAggregates'Sum' ], );
  <title>Basic Summary Demo</title>
  <h1>Basic Summary Demo</h1>
  <form action="" method="post">
    <div id="<?php echo( $grid->Name ); ?>_outer">
<?php $grid->dumpContents(); ?>