Grid OptionsConnector like OptionsConnector for scheduler


Here is a sample of making OptionsConnector for scheduler: … onnector&s[]=optionsconnector

There is piece:


How can I make the same linkage for grid on client side?

You can use OptionsConnector for grid in the same way. There is no need to define extra linking on client side. Using something like next on server side is enough

$grid->set_options("fieldA", $optionsConnector); $grid->render_table("some","id", "fieldA, fieldB")

if grid has related column ( first column for the above code ) as combo or co|coro type - it will be filled with options from $optionsConnector.

It partly decided problem. Thank you. But I need solution somthing like set_options of set_options or filter of set_options. Other words, I need to load data to “coro” cell depending of row id.

the current code:

$options = new OptionsConnector($res,“MySQL”);

$options->render_sql(“select id as value, name as label, prop_id from measure”,“id”,“id(value),name(label)”); // here I played with sql “where prop_id=…” . it is not apropriate as dara selection will be correct for only some rows.

$conn = new GridConnector($res,“MySQL”);// connector initialization

$conn->render_sql(“select * from obj_prop where str_id=$str_id”,“id”, “prop_id, prop_name, measure, value, cls_id, str_id”);

Unfortunately there is no way to produce the necessary xml structure with PHP connector. Existing options generator can generate options collection once for all grid only.

where can I find documentation of building xml for grid “manually” without php connector? … dhtmlxxml/

is it?

ok, I understand how to construct and load custom xml data for grid without connector.

But what is the best mechanism to save data?

You can use dataprocessor or serialize data back to XML
In case of dataprocessor, you can use ready handlers that can save data to the target DB, or define your own server side handlers that will receive data each time as record in the grid was changed, added or removed.

I am tryng to load data to grid:

<?php error_reporting(E_ALL ^ E_NOTICE); if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) { header("Content-type: application/xhtml+xml"); } else { header("Content-type: text/xml"); } echo("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");


for($i = 0;$i<10;$i++){

How to load to last cell the id-value pairs of co depending row id?

I have tried following:

  1. head, column, option tags. In this case I cannot control loading data depending row id.
  2. <![CDATA[OneTwo]]>. In this case I get other style select box with “OneTwo” instead “One” on the first row of select box and “Two” on the second.

Your cell in the xml should have the following format:
1The firstThe second

Here you can find a tutorial describing the co/coro usage in the grid: … n_from_xml

Thank you. It works fine.

It works fine as grid. Thank you:

<?php error_reporting(E_ALL ^ E_NOTICE); if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) { header("Content-type: application/xhtml+xml"); } else { header("Content-type: text/xml"); } echo("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");


require_once ‘config/dbconnect.php’;
require_once ‘config/vars.php’;
$str_id = “”; if (isset($_POST[‘str_id’])) { $str_id = $_POST[‘str_id’]; } if (isset($_GET[‘str_id’])) { $str_id = $_GET[‘str_id’]; }

$query_sel = "select id, info_id, info_name, v_value, pointer, p_value, media, str_id, cls_id, incl_id from obj_info where str_id=$str_id";

while ($row = $res->fetch_row()) {

print("<row id='$row[0]'><cell>$row[0]</cell><cell>$row[2]</cell><cell>$row[3]</cell><cell>$row[4]</cell><cell>$row[5]</cell><cell xmlcontent='true'>$row[6]");

$query_sel22 = "select digits, words from level where prop_id=$row[1]";

while ($row22 = $res22->fetch_row()) {

	print("<option value='$row22[0]'>$row22[1]</option>");





What about treegrid?

It works in the same way.

The only difference between grid’s and treegrid’s xml is the nesting structure. In case of TreeGrid row tag can contain row sub tags.

Do you have any sample?

Unfortunately I don’t have a full sample for TreeGrid with custom options.

I am trying to implement this solution but it does not work.
here’s my code (xml/ufficiPreferiti.php):


$uffici = new OptionsConnector($db,“MySQLi”); // ADDED
$uffici->render_table(“uffici”,“id”,“id(value),nomeCompleto(label)”); // ADDED

$grid = new GridConnector($db,“MySQLi”);
$grid->set_options(“idUfficio”, $uffici); // ADDED

On server side, I get the same xml result with and without the lines marked with “ADDED” - i.e. I get only the xml of the grid data, without any options data.

On client side, with the following code, I see no difference either, I see the id in the combo column (idUfficio), not the label/name (uffici.nomeCompleto)

[code] grid_1.setIconsPath(’./codebase/imgs/’);

grid_1.load('./xml/ufficiPreferiti.php', 'xml');[/code]

Am I missing something?

P.S. I am using DHTMLX 4.0.3 PRO

So far both client and server side code look fine.
Can you share the xml generated by /xml/ufficiPreferiti.php

Also, are you using single dhtmlx.js or separate js files for different components ? In second case, be sure to include connector.js

see attachment
I guess that I should see something like this instead, shouldn’t I?

single dhtmlx.js

I can’t attach the xml, I paste it here:

<?xml version="1.0" encoding="UTF-8"?> <rows> <row id="21"> <cell>0011910151</cell> <cell>GDP</cell> <cell>1</cell> </row> <row id="19"> <cell>0012720095</cell> <cell>ESIM</cell> <cell>2</cell> </row> <row id="38"> <cell>0230910097</cell> <cell>CC</cell> <cell>2</cell> </row> <row id="22"> <cell>0230910155</cell> <cell>GDP</cell> <cell>2</cell> </row> <row id="20"> <cell>0241160092</cell> <cell>CC</cell> <cell>2</cell> </row> <row id="17"> <cell>0241160092</cell> <cell>ESIM</cell> <cell>1</cell> </row> <row id="34"> <cell>0241160092</cell> <cell>ESM</cell> <cell>1</cell> </row> <row id="13"> <cell>0241160092</cell> <cell>LAV</cell> <cell>2</cell> </row> <row id="35"> <cell>0241160092</cell> <cell>VG</cell> <cell>2</cell> </row> <row id="37"> <cell>0241160150</cell> <cell>GDP</cell> <cell>2</cell> </row> <row id="33"> <cell>0250060090</cell> <cell>ESM</cell> <cell>1</cell> </row> <row id="36"> <cell>0250060090</cell> <cell>FALL</cell> <cell>2</cell> </row> <row id="26"> <cell>0250060090</cell> <cell>LAV</cell> <cell>2</cell> </row> <row id="28"> <cell>0270420065</cell> <cell>LAV</cell> <cell>2</cell> </row> <row id="32"> <cell>0270421157</cell> <cell>GDP</cell> <cell>1</cell> </row> <row id="25"> <cell>0280600097</cell> <cell>FALL</cell> <cell>2</cell> </row> <row id="18"> <cell>0370060094</cell> <cell>ESIM</cell> <cell>2</cell> </row> </rows>