I am building a test app with kendo ui php.
I am using a grid following the examples I have found on telerik web site.
The grid works correctly on a single table, but I am not able to get it working if I try adding a field from another table.
In the example I have, which is working correctly, you set the read table fields in this way:
$read_columns
=
array
(<br>
'p.ProductID'
, <br>
'p.ProductName'
, <br>
'p.UnitPrice'
, <br>
'p.UnitsInStock'
, <br>
'p.SupplierID'
,<br>
'(select s.CompanyName From Suppliers s Where s.SupplierID = p.SupplierID) as SupplierName'
,<br>
'p.CategoryID'
,<br>
'(select c.CategoryName From Categories c Where c.CategoryID = p.CategoryID) as CategoryName'
,<br> );
I was able to setup the datagrid without foreign fields:
$read_columns2
=
array
(<br>
'idAnagraficaPDV'
,<br>
'data'
,<br>
'ora'
,<br>
'downloadStatusId'
,<br>
//'(select s.descrizione From downloadstatus s Where s.downloadStatusId = d.downloadStatusId) as downloadstatus',<br> // '(Select s.descrizione From downloadstatus s Where s.downloadStatusId IN (Select d.downloadStatusId From d)) as descrizione'<br> // '(Select s.descrizione From downloadstatus s Where s.downloadStatusId IN (Select d.downloadStatusId From downloadlogs d))'<br><br><br> );
but if I try adding the foreign fields - removing the comments from one of the commented lines, I get no more data in datagrid. Note that the script passes to the browser a json array with the correct count of records but without data:
{
"total"
:2,
"data"
:[]}
while removing commenting the query line it retrieves the correct data, but of course without the field I need:
{
"total"
:3,
"data"
:[{
"idAnagraficaPDV"
:
"2"
,
"data"
:
"2015-11-07"
,
"ora"
:
"15:55:00"
,
"downloadStatusId"
:
"1"
},{
"idAnagraficaPDV"
:
"2"
,
"data"
:
"2015-10-06"
,
"ora"
:
"06:20:00"
,
"downloadStatusId"
:
"2"
},{
"idAnagraficaPDV"
:
"2"
,
"data"
:
"2015-11-09"
,
"ora"
:
"05:00:07"
,
"downloadStatusId"
:
"3"
}]}
Note the query I have set in string works correctly in the database.
Any suggestion?