php-ej1-demos/Grid/sorting.php

30 строки
1.0 KiB
PHP

<?php
require_once '../EJ/AutoLoad.php';
?>
<div class="cols-sample-area">
<?php
$Json = json_decode(file_get_contents("data.json"), true);
$grid = new EJ\Grid("Grid");
$col1 = new EJ\Grid\Column();
$col1->field("OrderID")->headerText("OrderID")->textAlign("right")->width(100);
$col2 = new EJ\Grid\Column();
$col2->field("CustomerID")->headerText("CustomerID")->width(70);
$col3 = new EJ\Grid\Column();
$col3->field("EmployeeID")->headerText("EmployeeID")->textAlign("right")->width(70);
$col4 = new EJ\Grid\Column();
$col4->field("ShipCountry")->headerText("ShipCountry")->width(70);
$col5 = new EJ\Grid\Column();
$col5->field("Freight")->headerText("Freight")->textAlign("right")->format("{0:C}")->width(70);
$gridColumns = array($col1,$col2,$col3,$col4,$col5);
echo $grid -> dataSource($Json)->allowPaging(true)->columns($gridColumns)->allowSorting(true)->render();
?>
</div>
<style>
.cols-sample-area {
margin:0 auto;
float:none;
}
</style>