Currently editing an application built using YUI 2.5 and Perl. I need to populate a dropdown from an xml file, and only specific rows are to be used depending on the attributes of the node. Unfortunately, there isn't the DropdownCellEditor widget in YUI 2.5 (as far as I'm aware, this didn't come in until 2.6(?)). Does anyone have any ideas?
I'm thinking I should probably just update YUI as there seems to be a lot of useful functionality missing in this very old version. The code the original developer is using is very convoluted, so this is my last try! Any advice would be greatly appreciated...
I haven't used YUI2 for quite some time now, but I had built an example back then:
http://www.satyam.com.ar/yui/#dynamicDropdown
I hope it still works.
Just incase anyone else is stuck with something similar, I managed to populate the dropdown from an XML file as follows:
//create function to read XML
function loadXMLDoc(dname)
{
if (window.XMLHttpRequest)
{
xhttp=new XMLHttpRequest();
}
else
{
xhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xhttp.open("GET",dname,false);
xhttp.send();
return xhttp.responseXML;
}
// load xml file
xmlDoc=loadXMLDoc('xmlsource.asp' + gameid);
teamnames =[];
var teams = xmlDoc.getElementsByTagName("hometeams");
for (var i = 0; i < teams.length; i++) {
var hname = teams[i].getAttribute("name");
teamsnames.push(hname);
}
Then later on in column definitions:
var eventColumnDefs = [
{key:"teamname", sortable:true, editor:"dropdown", editorOptions:{dropdownOptions:teamnames}}
];
I hope this helps someone. Thank you Satyam for your help on this and my other question. =]