PDA

View Full Version : Combobox display for Column in Grid



wilsondmsft
13 Sep 2007, 3:23 AM
When using the grid, is it possible to have a column display it's data in a Ext.form.Combobox instead of the normal div.

I have tried many things so hopefully I am just missing something or doing each of these wrong.

The main approach I thought would work was to implement a Custom Renderer that outputs a select list. The problem here is I cannot find a way to reliably post process the Grid to turn each of these selects into a ComboBox. I attempted to do this inside the renderer at first but realized that the object isn't in the DOM until after all the Grid has finished rendering everything.

Ideas?

Thanks in advance for any help!

methodz
5 Oct 2007, 7:04 AM
Why not use something like this

renderer : function(v,c,r){
cb_value = '<input type="checkbox" id="assoc_'+r.get('id')+'">';
cb_checked_value = '<input type="checkbox" id="assoc_'+r.get('id')+'" checked>';
if (r.get('type') == "associated")
{
return cb_checked_value;
}
else
{
return cb_value;
}

Then on the grid.getDataStore().on('load'... convert them to Ext ones.

You'll also have to hook the selectionchange event to uncheck them, but you're assigning them ids, so it's very simple.

The thing i'm having a hard time with is pre-selecting the items and also passing state, but once I get that figured out I can post it if you want :)