3.0 beta 2

Dynamic combo in a grid with callback function


I'm desperately looking for a working example of a grid using combo's which content is generated from server side data (data query ie) and could be different for the records in the grid.

many thanks in advance!
February 4,
This is a static example, but at least it shows how to make a combo where the content is different for each row (using a function as a list source) -

var myData = [
    ["cell1", "cell2", "cell3"],
    ["cell1", "cell2", "cell3"],
    ["cell1", "cell2", "cell3"]

var myItems = [
    ["item11", "item12", "item13", "item14"],
    ["item21", "item22", "item23"],
    ["item31", "item32"]

function itemText(i){  // only item index is exposed - BUG
    var col = this.$0; // column index is in internal $0
    var row = this.$1; // row index is in internal $1
    return myItems[row][i];

function itemCount(){
    var col = this.$0;
    var row = this.$1;
    return myItems[row].length;

var list = new AW.UI.List;

var obj = new AW.UI.Grid;

obj.setCellTemplate(new AW.Templates.Combo, 1);
obj.setCellTemplate(new AW.Templates.Combo, 2);

obj.setPopupTemplate(list, 1);
obj.setPopupTemplate(list, 2);

Alex (ActiveWidgets)
February 6,
The code above does not work in Firefox. When you change the entry in the combo box, it stays open, the combo box does not close anymore.
Isaac (BMS)
February 6,
which version of AW/browser/OS are you using?
Alex (ActiveWidgets)
February 7,
I am using AW 2.5.1 in Firefox in Linux (RedHat Rel5)
Isaac (BMS)
February 8,
I have tested this code in Ubuntu 7.10 in Firefox and and I don't see anything wrong so far. Do you think this is specific to RedHat? Did you run the code unmodified exactly as the sample above?
Alex (ActiveWidgets)
February 12,
Alex, seems to be not only linux specific, I can reproduce it in xp with Moz.
In my case if a drop-down combo list is open, and click on a different combo arrow, then the first list doesn't hide any more.
February 12,
Also clicking twice on the same combo-arrow produces the same "unclosable list-popup" effect.
February 12,
Sorry, my fault - I see it now. The example above misses setCellEditable(true) which is required for normal combo operation. Apparently without this line the popup does not close in FF (bug).
Alex (ActiveWidgets)
February 12,
Ahhaaa ... it was there.. ,
Thanks Alex,
February 12,

This topic is archived.

See also:

Back to support forum


Version 2

Looking for AW 2.6 ?
The old site is here.