3.2.0

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
May 10,
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.Combo, 1);

    obj.setPopupTemplate(list1, 1);

    document.write(obj);



You'll also need this patch -

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

var combo = new AW.Templates.Combo;
batchControlsGrid.setCellTemplate(combo, 0);
grid.setPopupTemplate(function(col, row) {
    var grid = this;
    var list = new AW.UI.List;

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

    list.onItemClicked = function(event, i){
        var text = this.getItemText(i);
        grid.setCellText(text, col, row);
        grid.setCellValue(text, col, row);
        grid.getCellTemplate(col, row).hidePopup();
    }
    return list;
});
Neil Craig
June 7,
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(rowCombo, 6, 0); 
 	obj.getCellTemplate(6, 0).refresh()

    obj.setPopupTemplate(function(col, row){ 

        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(event, i){ 
            var text = this.getItemText(i); 
            grid.setCellText(text, col, row); 
            grid.setCellValue(text, col, row); 
            grid.getCellTemplate(col, row).hidePopup(); 
        } 
        
        if(col == 6){
            docList.setSize(obj.getColumnWidth(6), 85);
            return docList;
        } 
    }); 
   // END COMBO POPUP CODE
Colin P
June 8,
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.
October 26,

This topic is archived.

See also:


Back to support forum