Help adding combo to grid

Hi Guys

Could someone please show me how to add a combo box to a grid column when using attachGrid() to a layout and Connector ? I have checked the documentation but I can’t figure it out.

[code]contactsGrid = layout.cells(“a”).attachGrid();


Is how I’m creating the grid.

I then pull in data via get_urls (this is using CodeIgniter and phpci):

[code] public function get_urls()
$connector = new GridConnector($this->db, “phpCI”);
$connector->configure(“tblurl_custom”, “id”, “domain, path, category”);


This works fine if I just want to edit cells as text input boxes. I want to make the 3rd column a drop down when double clicked, which uses a list of values also obtained from the database. How do I go about this ? It does not seem to be covered clearly in the examples.

I had a look at Excell’s but it still doesn’t make sense to me.

Any help appreciated


Please, try to use co/coro exCell type: … n_from_xml
or a “combo” exCell: … cell_combo

Thank you… I could not find the first link when searching the docs. I will try with this approach, it looks like it should work for me. If I can get a proof of concept working I will be able to purchase the Pro version :slight_smile:

I’m still not having much luck, I don’t suppose you could post a basic example ?

What I observe is, if I add a column as combo, e.g.

contactsGrid.setColTypes("ed,ed,co"); combo = contactsGrid.getCombo(2); // 3rd column combo.put("hello", "world");

The GET request made by the grid appends ?connector=true&dhx_colls=2

Then I get a 500 Internal Server Error:

This query must be happening inside the connector but I have told the phpCI to use my own model e.g.:

$this->load->database(); $this->load->model("url_model"); $connector = new GridConnector($this->db, "phpCI"); $connector->configure("tblurl_custom", "id", "domain, path, category"); $connector->useModel($this->url_model); $connector->render();

However this does not appear to be used. Confused!

Ah, I fixed it by adding the table that contains the ‘category’ field to the “configure” parameter, e.g.

$connector->configure("tblurl_custom, tblurl_custom_categories", "id", "domain, path, category");

Is there a document on “configure” ?


Sorry, one more question…

Using the method above, how can I set the option ID and value ? Right now the query returns the category name only. How do I tell the treegrid to use one field as ID and another field as value ?

My query would be changed as follows:

select as id , as category_id, tblurl_custom_categories.category as category, tblurl_custom.domain as domain, tblurl_custom.path as path FROM tblurl_custom, tblurl_custom_categories WHERE tblurl_custom.category_id = AND tblurl_custom_categories.is_bypass = 0

So in the grid column 1 = domain, column 2 = path, column 3 = category but within the 3rd column combo it should use:

<option value="CATEGORY_ID">CATEGORY</option>

rather than


This will make it easier for updating the database once the combo box has changed.