3.2.0

Change the SelectedItem of a combo inside a Grid

Hello,

I'm implementing a combo inside a Grid, and by business rule the selected item of the combo should be the same of another field in the Grid.

Anyway, I'm trying this suggestion I saw somewhere in the forum:

var cmb = new AW.UI.Combo;
            cmb.setItemText(["Seleccione","Por Enviar","Rechazado"]);
            cmb.setItemValue(["-1","2","3"]);
            cmb.setItemCount(3);
                                                               
            var filas = AWGDetalle_awg.grid.getRowCount(); 
            
            for(var i=0; i<filas; i++){
                var idEstado = AWGDetalle_awg.grid.getCellText(21,i);
                
                if( idEstado == '1'){
                    AWGDetalle_awg.setCellTemplate(new AW.Templates.Cell,22,i);
                    AWGDetalle_awg.grid.setCellText("ENVIADO",22,i);
                }
                else{ 
[b]                    cmb.setSelectedItems([idEstado]);
                    cmb.setControlText(cmb.getItemText(idEstado));[/b]
                    AWGDetalle_awg.setCellTemplate(cmb,22,i);
                }                    
            }



But the Combo always shows the "Seleccione" item. How can I change the Selected Item of the combo? Am I missing something here?


Best Regards.
Tonio
March 23,
Apparently, the bold codes don't work inside code blocks, sorry.

I'm highlightening the lines I'm trying to set the vaule with:

cmb.setSelectedItems([idEstado]);
cmb.setControlText(cmb.getItemText(idEstado));
Tonio
March 23,

This topic is archived.

See also:


Back to support forum