Grid with linked tables

2 posts, 0 answers
  1. Paolo
    Paolo avatar
    28 posts
    Member since:
    Nov 2015

    Posted 11 Nov 2015 Link to this post

    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:


    while removing commenting the query line it retrieves the correct data, but of course without the field I need:



    Note the query I have set in string works correctly in the database.

    Any suggestion?


  2. T. Tsonev
    T. Tsonev avatar
    2794 posts

    Posted 16 Nov 2015 Link to this post


    Please accept my apologies for the delayed response.

    The UI for PHP Grid will not evaluate inline SQL in column names. You have to execute the query in advance and populate the column names with the resulting values.

    I hope this helps.

    T. Tsonev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top