PDA

View Full Version : ExtGrid - howto show 2 columns - combobox & child combobox



softm
18 Feb 2011, 12:14 AM
I have ExtGrid (EditorGridPanel)
There are columns id, cat, subcat

On cat click - i show combobox & update grid cells (cat&subcat - setting first child or empty). There is all ok :)

When am trying make an combobox for "child" column subcat - i need render each time different combobox, depending on cat column vallue.

I try make editor, with listener beforerender, to fill this combobox which already exists as empty <select> in html):


.....
,{
header : "Subcat"
,dataIndex : 'subcat'
,sortable : true
,width: 200
,hidden:true

,renderer: function(value, metaData, r) {
metaData.attr = rowcolor(r.data.status);
return value;
}

,editor : new Ext.form.ComboBox({
typeAhead : true
,listClass : 'x-combo-list-small'
,triggerAction : 'all'
,lazyRender : true
,transform: 'subcateg_combo'

,mode : "remote"

,listeners: {

beforerender : function( comp )
{
var n ="#subcateg_combo";
$( n ).find('option').remove(); //remove, then fill
$( n ).append( $("<option></option>") . attr("value","1"). text("#1") );
$( n ).append( $("<option></option>") . attr("value","2"). text("#2") );
$.log( "Before render of combobox." );
},


beforeshow : function( comp )
{
$.log( "edit subcat beforeshow" );

//fill in combo
var n ="#subcateg_combo";
$( n ).find('option').remove(); //remove, then fill
$( n ).append( $("<option></option>") . attr("value","3"). text("#3") );
$( n ).append( $("<option></option>") . attr("value","4"). text("#4") );
}
}

})
}
....

This fires events $.log() shows before show every time i edit this field, but combobox is not filled ...
Please help me - will it on each show of this combo

Thanks, Arsen

softm
18 Feb 2011, 10:34 PM
ok, now i ignore editor of column & make listeter of "onclick" of grid.
Then show fancybox. & make edit of subcategory there.
But this is not clear answer on my problem.
Can anybody help me?

Thanks ...