Grid and SQL problems

Hi,

I have set up a grid with connector and it’s working well.
However, as soon as I replace the render_table by render_sql, it stops working.
Here are my statements :

$sqlStr = "SELECT id,name,start,end,Arrtime,Deptime,price,price_2,color,active from period WHERE id_gite = $id"; $grid->render_table('period', "id","name,start,end,Arrtime,Deptime,price,price_2,color,active"); //$grid->render_sql($sqlStr, "id", "name,start,end,Arrtime,Deptime,price,price_2,color,active");

So, the only thing I do is replace above table by the sql statement.
It turns out to give an error on the client side :

this.obj.firstChild is null
bla bla bla/dhtmlx/dhtmlxGrid/codebase/dhtmlxgrid.js
Line 725

This is, becouse there is no header sent. Just the data.

I have checked all i could, but I cannot understand this.

Please help ?
Steven

Have you tried to send your headers in php file?

$this->getResponse()->appendHeader(“Content-Type:”.$header);

$header = application/xml;

check google how to set header in php;) The syntax I use is needed by my framework!

Hi,

No, the xml header is correct.
It’s just that the header data in the xml is not send.
Only a line of data is send (firebug)

The same thing happens when I have a co type column.
The select options are set, accepted, and so on, I checked the whole
process on the server side. But no ‘select’ xml is send to the client.

thanks anyway for trying.
Steven

Try to update connector’s files with latest one (attached)
codebase.zip (51 KB)

Ok, thanks very much.
Now the display works just fine.
But to update the grid does not work.
I get an XML error (Incorrect XML) as soon as I try to change a field (or
delete a row).

Checked the XML, and for me it’s ok.

To load the grid :
I have this

$grid = new GridConnector($link);
		$config = new GridConfiguration();
			$config->setHeader("gite,Nom,Début,Fin,Arrivé,Départ,$mon1,$mon2,Couleur,Actif");
			//$config->setColIds("c1,c2,c3,c4,c5,c6,c7,c8,c9");
			$config->setInitWidths("1,160,70,70,70,70,90,90,60,60");
			$config->setColAlign("Left,left,left,left,left,left,right,right,center,center");
			$config->setColTypes("ro,ed,ed,ed,ed,ed,ed,ed,cp,ch");
//			$config->setColHidden(array("id_gite" => "true"));
			$grid->set_config($config);
	$grid->event->attach("beforeRender","formatting");
    $grid->event->attach("beforeUpdate","my_update");
   	$grid->enable_log("error.log", true);
	$grid->enable_live_update('period');
	$sqlStr = "SELECT id,id_gite, name,start,end,Arrtime,Deptime,price,price_2,color,active from period WHERE id_gite = $id";
//$grid->render_table('period', "id","id_gite,name,start,end,Arrtime,Deptime,price,price_2,color,active");  
//$grid->render_sql($sqlStr, "id", "id_gite, name,start,end,Arrtime,Deptime,price,price_2,color,active");


    if ($grid->is_select_mode())//code for loading data
		$grid->render_sql($sqlStr, "id", "id_gite,name,start,end,Arrtime,Deptime,price,price_2,color,active");
    else //code for other operations - i.e. update/insert/delete
		$grid->render_table('period', "id","id_gite, name,start,end,Arrtime,Deptime,price,price_2,color,active");  

As you can see, I tried first just an render_sql, then the if statement on the end (commented out the simple render_sql). It makes no difference.

Steven