<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Grid Sort Test</title>
</head>
<body>
<style type="text/css">
.aw-quirks * {
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}
body {font: 12px Tahoma}
</style>
<script src="runtime/lib/aw.js" type="text/javascript"></script>
<link href="runtime/styles/classic/aw.css" rel="stylesheet">
<style type="text/css">
#myGrid {height: 400px; width: 950px}
/* make sure that all links are blue and remain blue. */
#myGrid a {color: #0000CC;}
#myGrid a:hover {color: #0000CC;}
#myGrid a:link {color: #0000CC;}
#myGrid a:visted {color: #0000CC;}
/* row and cell borders */
#myGrid .aw-grid-row {border-bottom: 1px solid #999999;} /* add HEIGHT here for multi-line cells, e.g. " height: 60px;" */
#myGrid .aw-grid-cell {border-right: 1px solid #999999;}
#myGrid .aw-grid-footer {border-right: 1px solid #999999; border-top: 1px solid #999999;
background-color: #ccffcc;
padding-right: 3px; padding-right: 3px; padding-bottom: 1px; padding-top: 1px;
font-weight: bold;}
/* alternate row colors */
#myGrid .aw-alternate-even {background: #ffffff;}
#myGrid .aw-alternate-odd {background: #f4f4f4;}
/* color of highlighted row(s) */
/* BLUEs: ade1ff 96d8fe 66ffff PINKs: ffd9d9* YELLOWs: ffefad */
#myGrid .aw-rows-selected {background: #ade1ff!important; color:#000000!important;}
#myGrid .aw-column-0 {width: 90px; text-align: left ; }
#myGrid .aw-column-1 {width: 100px; text-align: right ; }
/* box model fix for strict doctypes, safari */
.aw-strict #myGrid .aw-grid-cell {padding-right: 3px;}
.aw-strict #myGrid .aw-grid-row {padding-bottom: 3px;}
</style>
<script>
var myDataText = [];
var myDataValue = [];
</script>
<script>myDataText.push(["AIRBUS 22","$128.99"]); myDataValue.push(["AIRBUS 22","128.99"]);</script>
<script>myDataText.push(["AIRBUS 22","$2,181,888.43"]); myDataValue.push(["AIRBUS 22","2,181,888.43"]);</script>
<script>myDataText.push(["AIRBUS 22","($10,140.82)"]); myDataValue.push(["AIRBUS 22","-10,140.82"]);</script>
<script>myDataText.push(["AIRBUS 22","($30,196.26)"]); myDataValue.push(["AIRBUS 22","-30,196.26"]);</script>
<script>myDataText.push(["AIRBUS 22","$187,627.75"]); myDataValue.push(["AIRBUS 22","187,627.75"]);</script>
<script>myDataText.push(["AIRBUS 22","$539.40"]); myDataValue.push(["AIRBUS 22","539.40"]);</script>
<script>myDataText.push(["AIRBUS 22","($616.51)"]); myDataValue.push(["AIRBUS 22","-616.51"]);</script>
<script>myDataText.push(["AIRBUS 22","$201,079.85"]); myDataValue.push(["AIRBUS 22","201,079.85"]);</script>
<script>myDataText.push(["AIRBUS 22","($11,671.26)"]); myDataValue.push(["AIRBUS 22","-11,671.26"]);</script>
<!-- insert control tag -->
<span id="myGrid"></span>
<!-- create controls -->
<script type="text/javascript">
// define column labels
var columns = ["Program","Amount"];
var grid = new AW.Grid.Extended;
grid.setId("myGrid");
// set fixed columns on the left side
grid.setFixedLeft(0);
// set fixed columns on the right side
grid.setFixedRight(0);
// set selection mode to multiple rows
grid.setSelectionMode("multi-row");
// set number of columns to display. there may be other columns in myData that we do not want
// to show (e.g. hyperlinks).
grid.setColumnCount(2);
// set number of rows to display
grid.setRowCount(9);
// provide column labels
grid.setHeaderText(columns);
// show row selectors
grid.setSelectorVisible(true);
grid.setSelectorWidth(30);
grid.setSelectorText(function(i){return this.getRowPosition(i)+1});
// Disable the browser right-click context menu (copy, paste, select, print)
grid.setEvent("oncontextmenu", "return false");
grid.setController("copypaste", {});
// Set the data to display from myDataText
grid.setCellText(myDataText);
// Set the sort values
grid.setCellValue(myDataValue);
//grid.setCellValue(function(col, row){return parseFloat(myDataText[row][col].replace(/[^0-9.]/m, "")); }, 2);
//
var num = new AW.Formats.Number;
var str = new AW.Formats.String;
var date = new AW.Formats.Date;
grid.setCellFormat([str,num]);
//
grid.refresh();
</script>
</body>
</html>
This topic is archived.