:: Forum >>

RE: getId() don't get what setId() ?

I'm having the same problem described in this archived topic:

http://www.activewidgets.com/javascript.forum.22757.1/getid-don-t-get-what.html

I.e., I do setId on a list and then later the ID is not set (getId does not give me what I set it to), e.g.:

var list = new AW.UI.List;
list.setItemText(myItems);
list.setItemCount(4);
list.setId("test_list");

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

var ct = new AW.Templates.Combo;

obj.setCellTemplate(ct, 1,0);
obj.setPopupTemplate(list, 1,0);
ct.getPopupTemplate().setStyle("width", "100%");
ct.getPopupTemplate().setStyle("height", 8 * 17);

list.onItemClicked = function(event,i) {
var text = this.getItemText(i);
var thisId = this.getId(); //this is NOT 'test_list' but something like 'aw4-popup..'
alert(thisId + " : " + text);
}

document.write(obj);

How can I set the ID of the list and have it "stick"?
Andrew Smith
Friday, January 9, 2009
It is possible to set your own id only for the standalone objects. In your case the list is used as a template, so the template id will be generated automatically from the parent control id and the template name (and indices). So if you set the grid id to "myGrid" the popup id will be "myGrid-popup-1-0".
Alex (ActiveWidgets)
Tuesday, January 13, 2009

This topic is archived.


Back to support forum

Forum search