Last active
December 25, 2015 19:39
-
-
Save funkytaco/7029804 to your computer and use it in GitHub Desktop.
Use JSON with OpenJS Grid #openjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
$(function() { | |
$(".table-grid").grid(); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment