I think this should be pretty simple, but I just cannot get it to work.
I want an editable grid to use as one of its columns a combo box which is populated from a remote datasource. In my case it is a JSON or xml formatted source coming from PHP back end.
The combo box will essentially lookup a value from a related table based on the primary tables ID. An example would be an employees table which uses a combo box to select a related department from a departments table.
What would be the method of doing this?
Too many hours without a break I guess. Went to church, came back and all was revealed . As it turns out, the built in connector did the trick using the GridConnector with the OptionsConnector. This actually was very easy indeed! Thank you for the suggestions.
Placing the php code showing the connector usage here for others needing it…
<?php
// users.php
require_once("../../codebase/connector/grid_connector.php");
require_once("db.php");
$res=mysql_connect(DB_HOST,DB_USER,DB_PASSWORD);
mysql_select_db(DB_NAME);
$gridConn = new GridConnector($res,"MySQL");
$options = new OptionsConnector($res);
$options->render_table("vw_employees","ListID","ListID(value),ShortName(label)");
$gridConn->set_options("EmployeeID",$options);
$gridConn->dynamic_loading(20);
$gridConn->render_table("users","UserID","UserName,EmployeeID,Password,LastLogin","","");
?>
html script is below…
var myGrid = new dhtmlXGridObject('gridbox');
myGrid.setImagePath("../codebase/imgs/");
myGrid.setHeader("UserName,EmployeeID,Password,LastLogin");
myGrid.setInitWidths("*,200,*");
myGrid.setColAlign("left,left,left,left");
myGrid.setColTypes("ed,co,ed,dhxCalendar");
myGrid.setColSorting("str,str,str,date");
myGrid.enableSmartRendering(true);
myGrid.init();
myGrid.load("php/users.php");
myDP = new dataProcessor("php/users.php");
myDP.init(myGrid);
Get a guaranteed answer from DHTMLX technical support team
under the most suitable support plan