Hello.
I have problem with treegrid in easyui.
This is my sql:
CREATE PROCEDURE SysWeb.spFormGenerator
AS
SELECT FG.ID AS Sifra,
FG.ParentID,
ISNULL(FG.ParentID,0) AS _parentId,
FG.Redoslijed,
FG.Caption,
FG.Naziv,
FG.TemplateKod,
FG.GenerisaniKod,
FG.SComponent,
SC.Naziv AS SComponentNaziv
FROM SysWeb.FormGenerator AS FG
INNER JOIN SysWeb.SComponent AS SC ON SC.SComponent = FG.SComponent
This is my php that call sql:
<?php
include 'Konekcija/Konekcija.php';
include 'XLogin/session.php';
$CRUD = intval($_REQUEST['CRUD']);
if ($CRUD == 0)
{ $page = isset($_POST['page']) ? intval($_POST['page']) : 1;
$rows = isset($_POST['rows']) ? intval($_POST['rows']) : 10;
$offset = ($page-1)*$rows;
$result = array();
$procedura = "{call [SysWeb].[spFormGenerator]}";
$polja = sqlsrv_query( $konekcija, $procedura);
$row = sqlsrv_fetch_array($polja);
$result["total"] = $row[0];
$polja = sqlsrv_query( $konekcija, $procedura);
$items = array();
while($row = sqlsrv_fetch_object($polja)){
array_push($items, $row);
}
$result["rows"] = $items;
echo json_encode($result);
}
elseif ($CRUD == 1 || $CRUD == 2 || $CRUD == 3)
{ //1-INSERT 2-UPDATE 3-DELETE
//REST OF CODE
}
?>
This is my code for treegrid:
<div title="Form generator" style="padding:10px;">
<table id="grdFormGenerator" title="" class="easyui-treegrid" style="auto;height:310px"
toolbar="#toolbarFormGenerator" pagination="true" rownumbers="true" fitColumns="true" singleSelect="true"
data-options="
url:'dataFormGenerator.php',
idField:'Sifra',
treeField:'_parentId'">
<thead>
<tr>
<th field="Sifra" width="3%">ID</th>
<th field="_parentId" width="5%">Parent</th>
<th field="Redoslijed" width="3%">Redoslijed</th>
<th field="Caption" width="15%">Caption</th>
<th field="Naziv" width="15%">Naziv</th>
<th field="SComponent" width="5%">SComponent</th>
<th field="SComponentNaziv" width="15%">Komponenta</th>
</tr>
</thead>
</table>
</div>
SQL output ( also picture in attachment):
Sifra ParentID _parentId Redoslijed
7 NULL 0 1
8 1 1 2
9 8 8 3
12 9 9 1
16 9 9 2
18 9 9 5
19 9 9 6
20 9 9 7
21 9 9 3
Problem:
I see only one row, and there is no child rows.
Why?