Skip to content

Instantly share code, notes, and snippets.

@funkytaco
Last active December 25, 2015 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save funkytaco/7029804 to your computer and use it in GitHub Desktop.
Save funkytaco/7029804 to your computer and use it in GitHub Desktop.
Use JSON with OpenJS Grid #openjs
<?php
$rows['_1234'] =
array(
'rowone' => 'Row One',
'rowtwo' => 'Row Two',
'rowthree' => 'Row Three',
'rowfour' => 'Row Four',
'rowfive' => 'Row Five',
'rowsix' => 'Row Six'
);
$rows['_1235'] =
array(
'rowone' => 'Row One B',
'rowtwo' => 'Row Two B',
'rowthree' => 'Row Three B',
'rowfour' => 'Row Four B',
'rowfive' => 'Row Five B',
'rowsix' => 'Row Six B'
);
$data = array(
'rows' => $rows,
'nRows' => 1,
'order_by' => 'rowtwo',
'sort' => "asc",
'page' => "1",
'start' => 1,
'end' => 15,
'colData' => array()
);
echo json_encode($data);
<table class="table-grid" action="/json.php">
<tr>
<th col="rowone" width="60">One</th>
<th col="rowtwo" width="100">Two</th>
<th col="rowthree">Three</th>
<th col="rowfour" width="110">Four</th>
<th col="rowfive" width="90">Five</th>
<th col="rowsix" width="180">Six</th>
</tr>
</table>
<script>
$(function() {
$(".table-grid").grid();
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment