Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by LeitrimMan on Dec 10, 2009 08:28
open dhtmlx forum
Dataprocessor & Subgrid

Hi, how do I integrate a sub_grid to a grid which uses a dataprocessor to connect to the database.

i.e. I have

jobCalloutGrid.setHeader(' ,Crew,Task,Callout,Date,Start,Hours,Rate,Location,Contact,Status');
jobCalloutGrid.setColAlign("right,right,left,left,left,right,right,right,left,left,left");
jobCalloutGrid.setColTypes("sub_row_grid,ed,coro,coro,ed,ed,ed,ed,ed,ed,ed");    
jobCalloutGrid.setInitWidths("30, 65," + calloutVarWidth + "," + calloutVarWidth + ",80,60,60,60," + calloutVarWidth + "," + calloutVarWidth + ",100");

jobCalloutGrid.init();
jobCalloutdp= new dataProcessor("jobdetail2.php?action=jobcallouts&JobID=0");
jobCalloutdp.setUpdateMode("cell");
jobCalloutdp.init(jobCalloutGrid);    

on server

$GetCalloutsSQL = "select t1.CalloutID, t1.ClientID, t1.JobID, t3.CalloutName as JobCalloutName, t2.TaskDesc, t1.NumberCrew, t1.CalloutDate, t1.ChargeRate, t1.StartTime, t1.NumberHours, t4.lookuptext as COStatus, t1.Location, t5.ContactName from callouts t1, tasks t2, callouttypes t3, lookups t4, contacts t5 where t1.TaskID=t2.TaskID and t1.CallOutTypeID = t3.CalloutTypeID and t1.Status=t4.lookupvalue and t4.lookupkey='calloutstatus' and t1.JobID=$_GET[JobID] and t1.ContactID=t5.ContactID order by CalloutDate"; //, StartTime, TaskDesc asc";

$resconn->render_sql($GetCalloutsSQL,"CalloutID", "NumberCrew,TaskDesc,t3.CalloutName(JobCalloutName),CalloutDate,StartTime,NumberHours,ChargeRate,Location,ContactName,t4.lookuptext(COStatus)");

But with the above approach, all my main grid columns are one off, i.e. the column I added to hold the '+' for the sub grid now takes the first data column returned by the render_sql. I tried adding in a blank field beforehand but that doesn't work either!

thanks
    
Answer posted by dhxSupport on Dec 10, 2009 08:55
First column should contain path to the xml with sub grid. If first cell value is empty "+" will not render
Answer posted on Dec 10, 2009 10:09

do you mean in the render statement ?

$resconn->render_sql($GetCalloutsSQL,"CalloutID", "NumberCrew,TaskDesc,t3.CalloutName(JobCalloutName),CalloutDate,StartTime,NumberHours,ChargeRate,Location,ContactName,t4.lookuptext(COStatus)");

or in the header in the js

jobCalloutGrid.setHeader(' ,Crew,Task,Callout,Date,Start,Hours,Rate,Location,Contact,Status');

 

I want to load the subgrid in the same manner as the main grid, i.e. using a dataprocessor - is this possible?

Answer posted by Alex (support) on Dec 14, 2009 05:38

Hello,

if you call the $resconn->render_sql($GetCalloutsSQL,"CalloutID", "NumberCrew,TaskDesc,t3.CalloutName(JobCalloutName),CalloutDate,StartTime,NumberHours,ChargeRate,Location,ContactName,t4.lookuptext(COStatus)"); code, the NumberCrew field (the 1st column) should contain the path to the subgrid xml.