<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- Essential Studio for JavaScript theme reference -->
<link rel='nofollow' href="themes/default-theme/ej.web.all.min.css" rel="stylesheet" />
<!-- Essential Studio for JavaScript script references -->
<script src="scripts/external/jquery-3.1.1.min.js"></script>
<script src="scripts/external/jsrender.min.js"></script>
<script src="scripts/i18n/ej.culture.ru-RU.min.js"></script>
<script src="scripts/l10n/ej.localetexts.ru-RU.min.js"></script>
<script src="scripts/web/ej.web.all.min.js"> </script>
<!-- Add your custom scripts here -->
</head>
<body>
<?php
require_once 'Src/AutoLoad.php';
?>
<div class="cols-sample-area">
<?php
// setlocale(LC_ALL, 'ru_RU.utf8');
// Header("Content-Type: text/html;charset=UTF-8");
// $Json = json_decode(file_get_contents("data.json"), true);
$items = array(
array(
"OrderID"=> 10,
"CustomerID"=> "ВАСЯ"),
array(
"OrderID"=> 20,
"CustomerID"=> "Петя ")
);
$Json = $items;//json_decode(json_encode($items), true);
echo '<pre>'.print_r($Json, true).'</pre>';
//echo ($Json);
$col1 = new EJ\Grid\Column("locale");
$col1->field("OrderID")->headerText("OrderID")->textAlign("right")->isPrimaryKey(true)->width(100);
$col2 = new EJ\Grid\Column();
$col2->field("CustomerID")->headerText('CustomerID')->textAlign('right')->format('{0:C}')->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*/);
$grid = new EJ\Grid("Grid");
$edit =new EJ\Grid\EditSetting();
$toolbarItems = array("add","edit","delete","update","cancel");
$toolbar= new EJ\Grid\ToolbarSetting();
echo $grid ->locale("ru-RU") -> dataSource($Json) -> allowPaging(true)->columns($gridColumns)->editSettings($edit->allowEditing(true)->allowDeleting(true)->allowAdding(true))->toolbarSettings($toolbar->showToolbar(true)->toolbarItems($toolbarItems))->render();
?>
</div>
</body>
Attachment:
im_ERR_798444d2.rar