Odd side-effect of code for disabling horizontal scroll
Hi Alex,
To remove any horizontal scroll you kindly recommended using:
.aw-bars-spacer {width: 0px!important;}
obj.setScrollBars("vertical");
obj.onScrollBarsChanging = function(){return 1}; //cancel change
I've just discovered that the above code seems to have an odd side effect (in 2.5.5 and earlier). Here's what I mean.
1. Use the above code with a grid that has sufficient items to require a vertical scrollbar.
2. Scroll down vertically so the last item in the list comes into view.
3. Select that last item. Oddly, a new blank row appears under that last item, and the onRowClicked event doesn't fire. I have to select that last item a second time to get the onRowClicked event to fire.
Things work normally when I remove the above code.
Any thoughts? Much appreciated.
In case it helps, here's an example:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test</title>
<link href='aw.css' type='text/css' rel='stylesheet'></link>
<script src='aw.js' type='text/javascript'></script>
</head>
<body>
<span id="grid1"></span>
<script type="text/javascript">
var myData = [
["aa", "Text", "Number", "Text" ],
["bb", "Text", "Number", "Text" ],
["cc", "Text", "Number", "Text" ],
["dd", "Text", "Number", "Text" ],
["ee", "Text", "Number", "Text" ],
["ff", "Text", "Number", "Text" ],
["gg", "Text", "Number", "Text" ],
["hh", "Text", "Number", "Text" ],
["ii", "Text", "Number", "Text" ],
["jj", "Text", "Number", "Text" ],
["kk", "Text", "Number", "Text" ]
];
</script>
<style type=text/css>
#grid1 {height: 100%; font: Tahoma;}
#grid1 .aw-grid-row {border-bottom: 1px solid threedlightshadow;}
#grid1 .aw-mouseover-row {background-color: gainsboro}
#grid1 .aw-cells-selected, .aw-rows-selected {color: #fff!important;background: #396FA2!important;}
#grid1 .aw-rows-selected .aw-grid-cell {background: none!important;}
#grid1 .aw-bars-spacer {width: 0px!important;}
.aw-strict #grid1 .aw-grid-cell {padding-right: 3px;}
.aw-strict #grid1 .aw-grid-row {padding-bottom: 3px;}
#grid1 .aw-column-0 {display: none!important;}
#grid1 .aw-column-1 {width:80px; text-align: left;}
#grid1 .aw-column-2 {width:80px; text-align: left;}
#grid1 .aw-column-3 {width:80px; text-align: left;}
</style>
<script type="text/javascript">
var string = new AW.Formats.String;
var number = new AW.Formats.Number;
number.setTextFormat("");
number.setErrorText(" ");
var obj = new AW.UI.Grid;
obj.setId("grid1");
obj.setSelectionMode("single-row");
var myColumns = ["1", "2", "3", "4"];
obj.setCellFormat([string, string, number, string]);
obj.setColumnCount(4);
obj.setHeaderText(myColumns);
obj.setHeaderHeight(20);
obj.setCellText(myData);
obj.setControlSize(260,200);
var intArrayLength = myData.length;
obj.setVirtualMode(false);
obj.setRowCount(intArrayLength);
// ----------------------------------------
// Disable horizontal scroll
// ----------------------------------------
obj.setScrollBars("vertical");
obj.onScrollBarsChanging = function(){return 1};
obj.refresh();
obj.onRowClicked = function(event, index) {alert(obj.getCellText(0,index));}
</script>
</body>
</html>
To remove any horizontal scroll you kindly recommended using:
.aw-bars-spacer {width: 0px!important;}
obj.setScrollBars("vertical");
obj.onScrollBarsChanging = function(){return 1}; //cancel change
I've just discovered that the above code seems to have an odd side effect (in 2.5.5 and earlier). Here's what I mean.
1. Use the above code with a grid that has sufficient items to require a vertical scrollbar.
2. Scroll down vertically so the last item in the list comes into view.
3. Select that last item. Oddly, a new blank row appears under that last item, and the onRowClicked event doesn't fire. I have to select that last item a second time to get the onRowClicked event to fire.
Things work normally when I remove the above code.
Any thoughts? Much appreciated.
In case it helps, here's an example:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test</title>
<link href='aw.css' type='text/css' rel='stylesheet'></link>
<script src='aw.js' type='text/javascript'></script>
</head>
<body>
<span id="grid1"></span>
<script type="text/javascript">
var myData = [
["aa", "Text", "Number", "Text" ],
["bb", "Text", "Number", "Text" ],
["cc", "Text", "Number", "Text" ],
["dd", "Text", "Number", "Text" ],
["ee", "Text", "Number", "Text" ],
["ff", "Text", "Number", "Text" ],
["gg", "Text", "Number", "Text" ],
["hh", "Text", "Number", "Text" ],
["ii", "Text", "Number", "Text" ],
["jj", "Text", "Number", "Text" ],
["kk", "Text", "Number", "Text" ]
];
</script>
<style type=text/css>
#grid1 {height: 100%; font: Tahoma;}
#grid1 .aw-grid-row {border-bottom: 1px solid threedlightshadow;}
#grid1 .aw-mouseover-row {background-color: gainsboro}
#grid1 .aw-cells-selected, .aw-rows-selected {color: #fff!important;background: #396FA2!important;}
#grid1 .aw-rows-selected .aw-grid-cell {background: none!important;}
#grid1 .aw-bars-spacer {width: 0px!important;}
.aw-strict #grid1 .aw-grid-cell {padding-right: 3px;}
.aw-strict #grid1 .aw-grid-row {padding-bottom: 3px;}
#grid1 .aw-column-0 {display: none!important;}
#grid1 .aw-column-1 {width:80px; text-align: left;}
#grid1 .aw-column-2 {width:80px; text-align: left;}
#grid1 .aw-column-3 {width:80px; text-align: left;}
</style>
<script type="text/javascript">
var string = new AW.Formats.String;
var number = new AW.Formats.Number;
number.setTextFormat("");
number.setErrorText(" ");
var obj = new AW.UI.Grid;
obj.setId("grid1");
obj.setSelectionMode("single-row");
var myColumns = ["1", "2", "3", "4"];
obj.setCellFormat([string, string, number, string]);
obj.setColumnCount(4);
obj.setHeaderText(myColumns);
obj.setHeaderHeight(20);
obj.setCellText(myData);
obj.setControlSize(260,200);
var intArrayLength = myData.length;
obj.setVirtualMode(false);
obj.setRowCount(intArrayLength);
// ----------------------------------------
// Disable horizontal scroll
// ----------------------------------------
obj.setScrollBars("vertical");
obj.onScrollBarsChanging = function(){return 1};
obj.refresh();
obj.onRowClicked = function(event, index) {alert(obj.getCellText(0,index));}
</script>
</body>
</html>
Justin
September 27,