This demo shows column sorting.
| ID | Title | Category | Author |
|---|---|---|---|
| 1 | Item 1 | 3 | Dennis |
| 2 | Item 2 | 5 | John |
| 3 | Item 3 | 2 | Chris |
| 4 | Item 4 | 3 | Jeremy |
| 5 | Item 5 | 6 | Chris |
| 6 | Item 6 | 5 | John |
| 7 | Item 7 | 3 | Dennis |
| 8 | Item 8 | 7 | Chris |
| 9 | Item 9 | 8 | Dennis |
| 10 | Item 10 | 3 | Jeremy |
| 11 | Item 11 | 9 | Dennis |
| 12 | Item 12 | 3 | John |
| 13 | Item 13 | 2 | Chris |
| 14 | Item 14 | 1 | Dennis |
| 15 | Item 15 | 5 | John |
| 16 | Item 16 | 3 | Jeremy |
<?php
include ('phpdatagrid.php');
// Include Sample data
include ('sampledata.php');
// Bind data to datagrid
$_DATAGRID->bind ('demo', $data);
?>
<html>
<head>
<title>PHP:DataGrid - Demo 4</title>
</head>
<body>
<h1>Simple PHP:DataGrid Sorting Demo</h1>
<p>This demo shows column sorting.</p>
<hr />
<strong>Sorted by: </strong><?php echo DG_SORT_BY . ' ' . DG_SORT_ORDER; ?><br /><br />
<php:datagrid name="demo" width="100%" AllowSorting="true" AutoGenerateColumns="false" cellpadding="5" cellspacing="0" border="true">
<Style font-family="Verdana" background-color="#eeeeee" font-size="12px" />
<HeaderStyle Background-Color="#fff" bold="true" text-color="#fff" />
<AlternateItemStyle background-color="#fff" />
<Column datafield="id" HeaderText="ID" />
<Column datafield="title" HeaderText="Title" />
<Column datafield="category" HeaderText="Category" />
<Column datafield="author" HeaderText="Author" />
</php:datagrid>
<hr />
<h2>Source:</h2>
<div style="background-color: #EFEFEF;"><?php highlight_file(__FILE__); ?></div>
</body>
</html>