Hi,
I have a grid being fed by a connector (PHP), with standard coro options set on a column using OptionsConnector() and set_options().
[code]
$grid = new GridConnector($db_connection);
$xxFilter = new OptionsConnector($bd);
$xxFilter->render_complex_sql(
"SELECT index AS value, description AS label FROM options_table .....",
"fieldname",
"value(value), label(label)"
);
$grid->set_options("fieldname", $xxFilter);
$sql = "SELECT * FROM datatable";
$grid->render_sql($sql, "index", "name,adress.....");[/code]
All is great, but i’d like to add a combo column with images.
I’ve looked at the source code for set_options() and it seems to be a “value,title” pair only, so no scope to set images from here (I think).
Setting the options to be images:
For coro the images are displayed correctly, but options are raw html.
If I set the column to combo, then the images are displayed correctly (as before) AND the options show correctly BUT the selected value in the cell showx the raw html ( <img src="… ).
Is there a way of setting this through the connector???
IF not then can I: set it on the client end using a custom column type (i’ve done with a window for text editing, but not with a combo); reset the column type to be the defined combo (no API for resetting a single column type) or over-ride the edit action of that column (but how do i popup the combo)?
Here is the client end code:
myCombo = new dhtmlXCombo({
parent:"column_combo",
name:"combo",
image_path:"/img/",
options: [
{value: "0", img_src: "stars0.png"},
{value: "1", img_src: "stars1.png"},
{value: "2", img_src: "stars2.png"},
{value: "3", img_src: "stars3.png"},
{value: "4", img_src: "stars4.png"},
{value: "5", img_src: "stars5.png"}
],
mode:"image"
});
myLayoutLocation = new dhtmlXLayoutObject({
parent: "location_data",
pattern: "1C",
skin: "dhx_skyblue",
cells: [
{
id: "a",
text: "",
header: false,
height: 400,
collapse: false,
}
]
});
mySubGrid = new dhtmlXGridObject('data_sub');
mySubGrid.setImagePath("/imgs/");
mySubGrid.setHeader("staff_id,Name,Email,Phone");
mySubGrid.setInitWidths("0,200,200,200");
mySubGrid.enableAutoWidth(true);
mySubGrid.setColTypes("ro,ro,ro,ro");
mySubGrid.init();
mySubGrid.loadXML('/grid_connector.php?area=subgrid&_='+Date.parse(new Date()), function(){
myGrid = myLayout.cells("a").attachGrid();
myGrid.setImagePath("/dhtmlx/codebase/imgs/");
myGrid.setSkin("dhx_skyblue");
myGrid.setColTypes("rotxt,edtxt,edtxt,coro,rotxt,rotxt.....);
myGrid.setSubGrid(mySubGrid,4,1);
myGrid.loadXML('/grid_connector.php?area=grid&_='+Date.parse(new Date());
dp = new dataProcessor("/grid_connector.php?area=grid");
dp.init(myGrid);
});
I’ve seen a few examples of a grid with a image combo box, but this was set through XML and not a connector.