This example loads data using ajax.
Name | Latin name |
---|
Include jquery, simple.datagrid.js and simple.datagrid.css.
<script src="jquery.min.js"></script>
<script src="simple.datagrid.js"></script>
<link rel="stylesheet" href="simple.datagrid.css">
Define the table and the column in html. You can define the datasource using the data-url property.
<table id="demo-table" data-url="/fruit_data/">
<thead>
<tr>
<th>Name</th>
<th>Latin name</th>
</tr>
</thead>
</table>
This example defines a table with id demo-table with columns Name and Latin name. It also defines the data-url /fruit_data/.
Initialize the datagrid by calling the simple_datagrid function.
Set the order_by value to true to enable sorting.
$('#demo-table').simple_datagrid({
order_by: true
});