EasyUI Forum
May 10, 2024, 07:12:31 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: TreeGrid problem  (Read 4954 times)
MFS
Newbie
*
Posts: 47



View Profile
« on: February 22, 2017, 01:01:40 AM »

Hello.
I have problem with treegrid in easyui.
This is my sql:
Code:
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:

Code:
<?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 == || $CRUD == || $CRUD == 3)
{ //1-INSERT 2-UPDATE 3-DELETE
//REST OF CODE
}
?>


This is my code for treegrid:

Code:
<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):
Code:
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?
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: February 22, 2017, 08:16:43 AM »

The '_parentId' field value of root node should be NULL.
Code:
Sifra	ParentID	_parentId	Redoslijed
7 NULL NULL 1
Logged
MFS
Newbie
*
Posts: 47



View Profile
« Reply #2 on: February 22, 2017, 10:51:03 AM »

The '_parentId' field value of root node should be NULL.
Code:
Sifra	ParentID	_parentId	Redoslijed
7 NULL NULL 1

I fix it and now _parentId is null but still dosnt work.
Picture is in attachment.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #3 on: February 22, 2017, 08:29:12 PM »

Please look at this example http://code.reloado.com/eniced/edit#javascript,html. It works fine.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!