:: Forum >>

Dynamic combo in a grid with callback function

Hi,

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!
walsumhof
Monday, February 4, 2008
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;
list.setItemText(itemText);
list.setItemCount(itemCount);

var obj = new AW.UI.Grid;
obj.setCellData(myData);
obj.setColumnCount(3);
obj.setRowCount(3);

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

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

document.write(obj);
Alex (ActiveWidgets)
Wednesday, February 6, 2008
Alex:
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)
Wednesday, February 6, 2008
Isaac:
which version of AW/browser/OS are you using?
Alex (ActiveWidgets)
Thursday, February 7, 2008
Alex:
I am using AW 2.5.1 in Firefox 2.0.0.11 in Linux (RedHat Rel5)
Isaac (BMS)
Friday, February 8, 2008
I have tested this code in Ubuntu 7.10 in Firefox 2.0.0.8 and 2.0.0.12 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)
Tuesday, February 12, 2008
Alex, seems to be not only linux specific, I can reproduce it in xp with Moz. 2.0.0.11.
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.
Carlos
Tuesday, February 12, 2008
Also clicking twice on the same combo-arrow produces the same "unclosable list-popup" effect.
Tuesday, February 12, 2008
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)
Tuesday, February 12, 2008
Ahhaaa ... it was there.. ,
Thanks Alex,
Carlos
Tuesday, February 12, 2008

This topic is archived.


Back to support forum

Forum search