3.2.0

[no subject]

I am working off this code that was posted and written by someone else:


<html>
<head>
<title>ActiveWidgets - Grid widget</title>
<style> body, html {margin:0px; padding: 0px; overflow: hidden;} </style>

<!-- ActiveWidgets stylesheet and scripts -->
<link href="activeui.css" rel="stylesheet" type="text/css" ></link>
<script src="activeui.js"></script>

<!-- grid format -->
<style>
.active-controls-grid {height: 100%; font: menu;}

.active-column-0 {width: 80px;}
.active-column-1 {width: 200px;}
.active-column-2 {text-align: right;}
.active-column-3 {text-align: right;}
.active-column-4 {text-align: right;}

.active-grid-column {border-right: 1px solid threedshadow;}
.active-grid-row {border-bottom: 1px solid threedlightshadow;background-color: white;}
</style>
<script>
var obj = new Active.Controls.Grid;
var myData = [
["MSFT","Microsoft Corporation", "Windows"],
["REDH","Red Hat Linux", "Linux"],
["Suse","Suse Linux", "Linux"],
["IBM","IBM Ltd.", "Websphere"],
["BEA","BEA Systems", "Weblogic"],
["APAC","Apache Org", "Tomcat"],
["MSFT","Microsoft Corporation", "Windows"],
["REDH","Red Hat Linux", "Linux"],
["Suse","Suse Linux", "Linux"],
["IBM","IBM Ltd.", "Websphere"],
["BEA","BEA Systems", "Weblogic"],
["APAC","Apache Org", "Tomcat"],
["MSFT","Microsoft Corporation", "Windows"],
["REDH","Red Hat Linux", "Linux"],
["Suse","Suse Linux", "Linux"],
["IBM","IBM Ltd.", "Websphere"],
["BEA","BEA Systems", "Weblogic"],
["APAC","Apache Org", "Tomcat"],
["MSFT","Microsoft Corporation", "Windows"],
["REDH","Red Hat Linux", "Linux"],
["Suse","Suse Linux", "Linux"],
["IBM","IBM Ltd.", "Websphere"],
["BEA","BEA Systems", "Weblogic"],
["APAC","Apache Org", "Tomcat"],
["MSFT","Microsoft Corporation", "Windows"],
["REDH","Red Hat Linux", "Linux"],
["Suse","Suse Linux", "Linux"],
["IBM","IBM Ltd.", "Websphere"],
["BEA","BEA Systems", "Weblogic"],
["APAC","Apache Org", "Tomcat"],
["MSFT","Microsoft Corporation", "Windows"],
["REDH","Red Hat Linux", "Linux"],
["Suse","Suse Linux", "Linux"],
["IBM","IBM Ltd.", "Websphere"],
["BEA","BEA Systems", "Weblogic"],
["APAC","Apache Org", "Tomcat"],
["MSFT","Microsoft Corporation", "Windows"],
["REDH","Red Hat Linux", "Linux"],
["Suse","Suse Linux", "Linux"],
["IBM","IBM Ltd.", "Websphere"],
["BEA","BEA Systems", "Weblogic"],
["APAC","Apache Org", "Tomcat"],
["MSFT","Microsoft Corporation", "Windows"],
["REDH","Red Hat Linux", "Linux"],
["Suse","Suse Linux", "Linux"],
["IBM","IBM Ltd.", "Websphere"],
["BEA","BEA Systems", "Weblogic"],
["APAC","Apache Org", "Tomcat"]
];

var myColumns = ["Ticker", "Company Name", "Products"];
function drawGrid()
{
obj.setRowCount(myData.length);
obj.setColumnCount(myColumns.length);
obj.setDataText(function(i, j){return myData[i][j]});
obj.setColumnText(function(i){return myColumns[i]});
obj.setRowHeaderWidth("28px");
obj.setColumnHeaderHeight("20px");
obj.setProperty("selection/multiple", true);
obj.setAction("click", function(src){window.status = src.getProperty("item/text")});
document.write(obj);
}
function populateListBox()
{
for(var c=0; c<myColumns.length; c++)
{
document.write("<option value="+c+">"+myColumns[c]+"</option>");
}
}
function searchGrid()
{
var colToBeSearched = document.forms['gridSearchForm'].colSearchName.value;
var toSearch = document.forms['gridSearchForm'].keyword.value;
var res = 0;
for(var x=0; x<myData.length; x++)
{
if((myData[x][colToBeSearched].indexOf(toSearch)) >= 0)
{
obj.getTemplate("row", x).setStyle("color", "white");
obj.getTemplate("row", x).setStyle("background", "blue");
res++;
}
else
{
obj.getTemplate("row", x).setStyle("color", "black");
obj.getTemplate("row", x).setStyle("background", "white");
}
}
document.getElementById('result').innerHTML = "<b>Number of matches : "+res+"</b>";
}
</script>
</head>
<body>
<table>
<tr>
<td>
<form name=gridSearchForm id=gridSearchForm>
<input type=text name=keyword>
<select name=colSearchName>
<script>
populateListBox();
</script>
</select><input type=button value=search onclick="javascript:searchGrid();">
</form>
</td>
</tr>
<tr>
<td>
<div id=result>
</div>
<tr>
<td width=650 height=300>
<script>
drawGrid();
</script>
</td>
</tr>
</table>
</body>
</html>







I want to change the part that looks like this:


var myData = [
["MSFT","Microsoft Corporation", "Windows"],
["REDH","Red Hat Linux", "Linux"],
["Suse","Suse Linux", "Linux"],
["IBM","IBM Ltd.", "Websphere"],
["BEA","BEA Systems", "Weblogic"],
["APAC","Apache Org", "Tomcat"],
["MSFT","Microsoft Corporation", "Windows"],
["REDH","Red Hat Linux", "Linux"],
["Suse","Suse Linux", "Linux"],
["IBM","IBM Ltd.", "Websphere"],
["BEA","BEA Systems", "Weblogic"],
["APAC","Apache Org", "Tomcat"],
["MSFT","Microsoft Corporation", "Windows"],
["REDH","Red Hat Linux", "Linux"],
["Suse","Suse Linux", "Linux"],
["IBM","IBM Ltd.", "Websphere"],
["BEA","BEA Systems", "Weblogic"],
["APAC","Apache Org", "Tomcat"],
["MSFT","Microsoft Corporation", "Windows"],
["REDH","Red Hat Linux", "Linux"],
["Suse","Suse Linux", "Linux"],
["IBM","IBM Ltd.", "Websphere"],
["BEA","BEA Systems", "Weblogic"],
["APAC","Apache Org", "Tomcat"],
["MSFT","Microsoft Corporation", "Windows"],
["REDH","Red Hat Linux", "Linux"],
["Suse","Suse Linux", "Linux"],
["IBM","IBM Ltd.", "Websphere"],
["BEA","BEA Systems", "Weblogic"],
["APAC","Apache Org", "Tomcat"],
["MSFT","Microsoft Corporation", "Windows"],
["REDH","Red Hat Linux", "Linux"],
["Suse","Suse Linux", "Linux"],
["IBM","IBM Ltd.", "Websphere"],
["BEA","BEA Systems", "Weblogic"],
["APAC","Apache Org", "Tomcat"],
["MSFT","Microsoft Corporation", "Windows"],
["REDH","Red Hat Linux", "Linux"],
["Suse","Suse Linux", "Linux"],
["IBM","IBM Ltd.", "Websphere"],
["BEA","BEA Systems", "Weblogic"],
["APAC","Apache Org", "Tomcat"],
["MSFT","Microsoft Corporation", "Windows"],
["REDH","Red Hat Linux", "Linux"],
["Suse","Suse Linux", "Linux"],
["IBM","IBM Ltd.", "Websphere"],
["BEA","BEA Systems", "Weblogic"],
["APAC","Apache Org", "Tomcat"]
];





So that it loads the tables contents from a csv file, something like this:
// provide data URL - plain text comma-separated file
table.setURL("../data/companies.csv");



Can someone show me what to do to get it to work, PLEASE!!
Ian
March 8,

This topic is archived.

See also:


Back to support forum