:: Forum >> Version 2 >>

Combo box in grid: drop down does not allow selection

Please help: ( I am running V2):

var grid= new AW.UI.Grid;

var oComboOptions = ['1', '2', '3'];
var oCombo = new AW.UI.Combo;
oCombo.setItemText(oComboOptions);
oCombo.setItemCount(oComboOptions.length);

//oCombo.getContent("box/text").setAttribute("readonly",true);
//oCombo.onControlEditStarted = function() { this.getContent("box/text").element().contentEditable = false;}
oCombo.onControlActivated = function(){ return true; }

oCombo.onControlClicked = function() {
this.showPopup();
}
oCombo.setControlText('1');
grid.setCellTemplate(oCombo, col, row);


The drop down appears but does not react to a selection. What am I doing wrong. I must note that there is a bit of babble about this problem but none seems to work. I am running IE6 and AW V2.

Many thanks
Jack Mansons
Wednesday, May 10, 2006
Jack,

here is an example using combo template -

var data1 = ["Email","Phone","FedEX","USPS"];

    var 
list1 = new AW.UI.List;
    
list1.setItemText(data1);
    
list1.setItemCount(data1.length);

    var 
obj = new AW.UI.Grid;

    
obj.setCellData("cell");
    
obj.setHeaderText("header");
    
obj.setColumnCount(10);
    
obj.setRowCount(10);

    
obj.setCellEditable(true);

    
obj.setCellTemplate(new AW.Templates.Combo1);

    
obj.setPopupTemplate(list11);

    
document.write(obj);

 
You'll also need this patch -

/javascript.forum.13299.8/fix-combo-template-not-closing.html
Alex (ActiveWidgets)
Wednesday, May 10, 2006
I'll also like to known when an item has been selected... what is the event to use?
Jack Mansons
Wednesday, June 7, 2006
This code might make it more clear:

var combo = new AW.Templates.Combo;
batchControlsGrid.setCellTemplate(combo0);
grid.setPopupTemplate(function(colrow) {
    var 
grid this;
    var list = new 
AW.UI.List;

    list.
setItemText(["Option 1""Option 2""Option 3"]);
    list.
setItemValue([123]);
    list.
setItemCount(3);

    list.
onItemClicked = function(eventi){
        var 
text this.getItemText(i);
        
grid.setCellText(textcolrow);
        
grid.setCellValue(textcolrow);
        
grid.getCellTemplate(colrow).hidePopup();
    }
    return list;
});
 
Neil Craig
Wednesday, June 7, 2006
I am having I slightly different (but I think related) problem with the last code snippet you have shown Neil.

The code works fine for me using the XP style sheet but when I use any other style sheet the list displays all on one line.
I.E.
ALLTITLECONTRACT...
v.s.
ALL
TITLES
CONTRACT
...
See my code below (How could the style cause this behaviour with the List?)

// BEGIN COMBO POPUP CODE 
    
rowCombo = new AW.Templates.Combo
    
rowCombo.setStyle("border"0);
    
rowCombo.setStyle("background""none");
    
obj.setCellTemplate(rowCombo60); 
     
obj.getCellTemplate(60).refresh()

    
obj.setPopupTemplate(function(colrow){ 

        var 
grid this
        var 
docList = new AW.UI.List; 
        var 
values = ["","<ALL>","TITLES""CONTRACT","WORKSHEET","MEDICAL","CHANGES","OWNMISC","FINANCIAL","REPL","POLMISC","MEMO","PROFS","REINS","TAX","INSMISC"];
        
docList.setItemText(values ); 
        
docList.setItemCount(16); 

        
docList.onItemClicked = function(eventi){ 
            var 
text this.getItemText(i); 
            
grid.setCellText(textcolrow); 
            
grid.setCellValue(textcolrow); 
            
grid.getCellTemplate(colrow).hidePopup(); 
        } 
        
        if(
col == 6){
            
docList.setSize(obj.getColumnWidth(6), 85);
            return 
docList;
        } 
    }); 
   
// END COMBO POPUP CODE  
Colin P
Thursday, June 8, 2006
Jack/Neil/Alex,

I have one question regarding this....
We can have all COMBO or all ENTRY Fields in a GRID.
But can we have COMBO and ENTRY Field in a row or column of a GRID?

Thanks,
Swapnil.
Swapnil.
Thursday, October 26, 2006



This topic is archived.

Back to support forum

Forum search