GridConnector render_sql is ignoring GridConfiguration

I started using the php GridConnector to get server side data for the Grid. I also wanted to use the GridConfiguration to set a few distinct configurations on the server side. It worked great with render_table, but when I use render_sql for a complex select query, it does not include the header data in the generated xml.

Any idea what I need to do to make this work? The complete code for the server side xml data generator is as follows:

<?php require("grid_connector.php"); require("db_oracle.php"); $res = oci_connect("user", "pass", "db"); $grid = new GridConnector($res, "Oracle"); $config = new GridConfiguration(); $config->setHeader(array("Name","Data Center", "OS", "Version", "Manufacturer", "Model", "Processors", "RAM", "Serial", "UUID", "Host Key", "Last Update")); $config->setInitWidths("200,80,180,160,150,240,90,60,100,270,240,150"); $config->setColAlign("left,left,left,left,left,left,left,left,left,left,left,left"); $config->setColTypes("ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro"); $config->setColSorting("str,str,str,str,str,str,int,int,str,str,str,date"); $grid->set_config($config); if (isset($_REQUEST['application'])) { $grid->render_sql("SELECT A.* FROM HOST_H A, APPLICATION_HOST B WHERE A.ID = B.HOST_ID AND B.APPLICATION_ID = '" . $_REQUEST['application'] . "'","ID","NAME, DATACENTER, OS, VERSION, MANUFACTURER, MODEL, PROCESSORS, RAM, SERIAL_NUMBER, BIOS_UUID, HOST_KEY, LAST_UPDATE"); } else { $grid->render_table("HOST_H","ID","NAME, DATACENTER, OS, VERSION, MANUFACTURER, MODEL, PROCESSORS, RAM, SERIAL_NUMBER, BIOS_UUID, HOST_KEY, LAST_UPDATE"); } ?>

Changing the following line in base_connector.php seems to have fixed the issue:

(Original)
return !($this->editing || $this->updating || $this->request->get_start() || sizeof($this->request->get_filters()) || sizeof($this->request->get_sort_by()));

(Fix)
return !($this->editing || $this->updating || $this->request->get_start() || isset($_GET[‘dhx_no_header’]));

Has this been fixed or not? I still am not able to use server side GridConfiguration with render_sql.

Greg

It is fixed in latest dev. version.
To be sure you can try to update the existing php file with attached one.
base_connector.zip (5.37 KB)

Hmm. Still not working for me. Using that attached new base_connector.php
Perhaps you can see something I’m doing wrong?

$convert = new ConvertService("server/generate.php");
$convert->excel("thefile.xls");
$gridConn = new GridConnector($res);
$config = new GridConfiguration();
$config->setHeader("Type,Priority,Name");
$config->setColTypes("ro,ro,ro");
$gridConn->set_config($config);
$sql="SELECT id,lead_type,lead_priority,biz_name FROM biz_list WHERE gip_id='40' AND lead_type='2'";
$gridConn->render_sql($sql,"id","lead_type,lead_priority,biz_name");

Greg

The same code works correctly locally ( with latest codebase )
You can try to update php file with the attached ones.
codebase.zip (51 KB)

I still get a zero k file, and I copied all the php files from that latest codebase.

Could it be a problem with my server/generate.php file? I got that from here somewhere, and it’s associated lib files, but I cannot remember where I got it. The files are dated about six months ago.

I turned on logging, and no errors being recorded.

Greg

Not quite sure
Try to grab the generation script from the next post
Also, check is the script’s folder has write access

dhtmlx.com/blog/?p=553