:: Forum >>

CSS dropped

Hello,
I am having an issue with my grid. It finds the data perfectly, but it doesn't seem to load the css at all. All my directories are correct, and when I use the examples everything, including css, works. So, I am assuming I am doing something wrong, just not sure what. I have posted my code so everyone can take a look. Any help at all would be helpful.
Thanks!
Joe

--HTML-----

<html>
<head>

<title>Twain and xAx Demo</title>
<link rel="stylesheet" type="text/css" href="/jcianflone/awtwain/javascripts/runtime/styles/aqua/aw.css" />
<script type="text/javascript" src="/jcianflone/awtwain/javascripts/config.js"></script>
<script type="text/javascript" src="/jcianflone/awtwain/javascripts/x.js"></script>
</head>
<body>
<input type="button" onclick="generatePage()" value="go"/>
</body>
</html>

-- JAVASCRIPT ---
var obj = new AW.UI.Grid;

function generatePage () {

var url = GLOBAL_SERVICES_URL+"getComponents.php?";

var params = "type=acute&userid=164236";
var myAjax = new Ajax.Request (
url,
{
method: 'get',
parameters: params,
onSuccess: doLogin
}
);
}//generatePage()...

function doLogin (response) {

//get XML
var res = response.responseXML;

//get first x
var xArray = res.getElementsByTagName("x");

var i = 9;

var m = 10;
var dataArray = new Array();
var l = 0;
//document.write ("<table border=1>");
for (var j=9; j < 20; j++) {
//document.write("<tr>");
dataArray[l] = new Array(4);
for (var k=0; k < 4; k++) {

var test = xArray[m].getAttribute("value");
if (test == null || test=="" || test == " ") {
m++;
k--;
}
else {
// document.write ("<td>")
dataArray[l][k] = test;
// document.write (dataArray[l][k]);
// document.write("</td>");
m++
}
}//for...
l++;
// document.write("</tr>");
}//for...
// document.write("</table>");

var myData = dataArray;
// alert (dataArray[0]);
var myColumns = ["Beds Available", "Last Updated", "Updated By", "All Hospitals"];



//obj.setId("myGrid"); // necessary for CSS rules

obj.setCellText(dataArray); // 2-dimensional js array

//obj.setCellEditable(true); // enable editing

obj.setHeaderCount(1);

obj.setHeaderText(myColumns); // js array (see top of this page)

obj.setColumnCount(dataArray[0].length);

obj.setRowCount(dataArray.length);

obj.setSelectorVisible(true);

//obj.setSelectorText(function(i){return this.getRowPosition(i)+1});
alert ("ready to write obj");
document.write(obj);
alert ("wrote obj");

}

Joe C
Monday, May 1, 2006
OK....I'll start, I think there is an issue with me putting everything in an external file and then using the document.write to write the grid. Not sure, and if that is actually the issue how do I work around that?

Thanks,
Joe
Joe C
Monday, May 1, 2006
You should use DIV.innerHTML = obj; instead of document.write(). When you call document.write() after the page loading is finished - it is equivalent of creating new page and writing there.
Alex (ActiveWidgets)
Tuesday, May 2, 2006

This topic is archived.


Back to support forum

Forum search