ComboBox not populated in the Grid with PHP connector

Hi
I’m trying this new version of dhtmlx (last one I used was 3 years ago !!) and it now implements a feature I had to code manually back then : PHP connection, great :slight_smile:

I tried and it works fine, update data, insert and all, so I’m really happy.

But I tried the thing I found in the sample where you link a cell to a combolist coming from another sql table and I’m stuck: the combo is empty except for the data already in the cell
I tried the “simple” version where you specify manually the list of data you want in the combobox… to no avail the combo is stil empty with only one value.

here is the code for the connector, I can’t debug it so I don’t know where I’m wrong, can anyone help me?

[code] require_once “…/db.inc”;
require("…/dhtmlx/connector/base_connector.php");
require("…/dhtmlx/connector/grid_connector.php");
require("…/dhtmlx/connector/options_connector.php");
$res=mysql_connect($dbserver,$user,$password);
mysql_select_db($database);

$grid = new GridConnector($res);    
$grid->enable_log("grid.log",true);
//$grid->dynamic_loading(100); 

$config = new GridConfiguration();
$config->setHeader(array("id","Player","Class","Role 1","Role 2"));
$config->setColTypes(array("ed","ed","co","co","co"));
$grid->set_config($config);

$filter1 = new OptionsConnector($res);
//$filter1->enable_log("filter.log",true);    
$filter1->render_table("st_class","id","id(value),ClassFR(label)");
$grid->set_options("ClassID", $filter1);

//$grid->set_options("ClassID",array("1","2","3","4"));
$grid->set_options("Role1ID", array("1","2","3","4"));
$grid->set_options("Role2ID", array("1","2","3","4"));   

$grid->sql->set_transaction_mode("record");    

$grid->render_table("st_player", "id");[/code]

sql fields for table st_player
id
player
ClassID
Role1ID
Role2ID

sql fields for table st_class
id
ClassFR
ClassEN
Description

(as you can see I tried to add the “enable_log” for the $filter1 var, it just ignore the first log and
start writing in the new one, dunno if it’s a bug or not)

All connector classes in the same connector file will share single log file. It is expected behavior.
As for problem with options generation.
Currently this need to be triggered by client side settings of grid, which is not working for the case when you are setting config on server side.

As temporary solution, you can add the next line

$_GET["dhx_cols"] = "0,1"; //indexes of columns, for which options need to be generated. $grid->render_table("st_player", "id", "Role1ID,Role2ID"); //somehow your code doesn't specify column fields

Its not very beautiful solution, but will work as temporary solution.
( if you interested in update which resolves original issue - contact us directly at support@dhtmlx.com )

okay, I think I understand, and as you said well it’s not really pretty.

Basically I wanted to have a maximum of things server side and I was not really keen on setting up the grid config in javascript since I had the option to do it in php.

Anyway, that’s not really a problem and I tried to set up the thing exactly as the sample06 of the grid, and it worked fine.

I’m setting up a few coding guideline I will use and I plan to generate all the grid automatically (kind of a small RAD with basic input capability and link to other table), so I don’t really mind if I have to change something to make it work :slight_smile:

I have a few things to sort out before though…

Has this ever been fixed? I’ve been watching the progress of dhtmlx and really like what I see. It would be really help to have this functionality if it’s been fixed. I tried it with the current version that available for download and it looks like it’s still broken.

Thanks,
Kyle

Latest dev. version has it fixed, but it still not released in public version.
Please contact us directly at support@dhtmlx.com if you need the updated code ASAP