<!-- grid data -->
<script type="text/javascript">
var conObj = new ActiveXObject('ADODB.Connection');
var connectionString = "Driver={Microsoft ODBC for Oracle};CONNECTSTRING=orcl.com;uid=wibstar;pwd=qwerty;"
conObj.Open(connectionString);
var rs = new ActiveXObject("ADODB.Recordset");
rs.Open("select name, lastname from users", conObj);
if(!rs.eof)
{
sRec=rs.GetString(2,-1,",","\n"," ");
myData = sRecs.split(/\n/);
for (var i=0; i<aRec.length; i++)
{
myData[i]=myData[i].split(/,/);
}
}
var myData = [
s
];
var myColumns = [
"name", "lastName"
];
</script>
</head>
<body>
<script type="text/javascript">
// create ActiveWidgets Grid javascript object
var obj = new AW.UI.Grid;
obj.setId("myGrid");
// define data formats
var str = new AW.Formats.String;
var num = new AW.Formats.Number;
obj.setCellFormat([str, str]);
// provide cells and headers text
obj.setCellText(s);
obj.setHeaderText(myColumns);
// set number of rows/columns
obj.setRowCount(myData.length);
obj.setColumnCount(myColumns.length);
// enable row selectors
obj.setSelectorVisible(true);
obj.setSelectorText(function(i){return this.getRowPosition(i)+1});
// set headers width/height
obj.setSelectorWidth(28);
obj.setHeaderHeight(20);
// set row selection
obj.setSelectionMode("single-row");
// set click action handler
obj.onCellClicked = function(event, col, row){window.status = this.getCellText(col, row)};
// write grid html to the page
document.write(obj);
rs.close;
</script>
This topic is archived.