Set Column Header thru connector.php

Hi,
Is it possible to set the grids column headers up thru the ‘connector.php’ server side?
I am trying to use the SQL’s table definition names as the grids column header.
Thx.

It is not possible for now, but will be added in the next version.

Hi,
I am playing with the following… in my ‘connector.php’

function grid_header(){
if (!isset($_GET[“posStart”]))
echo ’
[ID]
[Name]
[Name2]
// add any text filter or sorting here…
';
}

and going to use the SQL Table Column names and attributes… hopefully,
Thanks for the speedy reply.
Cheers,

If you are using connector - the only place where data can be outputted - Inside beforeOutput event handler. All other data output will be blocked.

Also, if you want to check dev. version of connectors, which is supporting server side configuration of grid - contact us directly at support@dhtmlx.com

I am having difficulty using combo thru dataconnector when I define the column types thru xml from the connector.php

The combo works if I define the column types (co/coro) in the HTML File using…
mygrid.setColTypes(“co,co,coro…”) but not in the XML.

Here is my connector.php section where I build the headers/filter/coltypes using ‘beforeOutput’
//////////////////////////////////////////
function grid_header(){
if (!isset($_GET[“posStart”]))
{
$db = new connection;
$res = mysql_connect(“localhost”, “root”, “”);
$db_selected = mysql_select_db($db->database,$res);
$result = mysql_query($db->sql(),$res);
$x = 0;
echo ‘’;
while ($property = mysql_fetch_field($result))
{
$col = $property->name;

		if ($x == 0){$type='coro';$width='90';}
		if ($x > 0){$type='edtxt';$width='*';}
		// if ($x == 2 && $db->table == 'training'){$type='dhxCalendar';}
		if (($x == 1 || $x == 3 || $x == 5) && $db->table == 'training') {$type='coro';}
		
		echo '<column width="'.$width.'" type="'.$type.'" align="left" sort="str">'.$col.'</column>';
    		$x++;
		}
		
		echo '<afterInit><call command="attachHeader"><param>';
		for ($y=0;$y<$x-1;$y++){
			if ($y && $db->table == 'training'){echo '#select_filter,';} else { echo '#text_filter,';}
		}
		echo '#select_filter</param></call></afterInit>';
			
	echo '</head>';
	mysql_close($res);
}
}

/////////////////////////////////////////////////
Here is my combo selection:

/////////////////////////////////////////////////
$course = new OptionsConnector($res);
$course->render_table(“course”,“cid”,“cid(value),title(label)”);
$student = new OptionsConnector($res);
$student->render_table(“student”,“sid”,“sid(value),firstname(label)”);

$gridConn->set_options(“facility”,array(“Barrie” => “Barrie”, “Other” => “Other”, “Toronto” => “Toronto”));
$gridConn->set_options(“grade”,array(“a”,“b”,“c”,“d”));

$gridConn->set_options(“cid”,$course);
$gridConn->set_options(“sid”,$student);

Again, this works thru Javascript initialization, but not thru XML in connector.php.

Thx.

When header defined on server side - connector can’t retrieve info about combo columns from client side. To fix situation you can add the next line.

$_GET["dhx_colls"]="1,2,3";

value of parameter - list of column indexes for which combo collections need to be loaded

Thank you for your reply.

Where in the .php do I insert this?
Before setOption or after, or does it matter.
Thanks for your support.

Before main render_table or render_sql command.