Serious sorting BUG but should be easy to fix
I ran into a bug and it should be very easy to fix for those with the tools. I have reproduced it easily with the "basic" grid example. Bring up the example and sort according to "Company Name". It sorts just fine.
Now, delete "Microsoft Corporation" (if it were only that simple ;-) ) so that it is an empty string (""). It actually does not sort correctly . . . an empty string should be at the top of the list when sorted ascending.
To illustrate the problem even better, you "Microsoft Corporation" back in and delete "Oracle Corporation" (the second item). Now sort and see the order completely messed up. You will see the order (first letter) as "", A, S, K, A, B, M, I, C, C, etc. Obviously, it is not in the correct order.
Different variations of empty strings will give different interesting results. A quick fix to this will be greatly appreciated.
Dyme
March 11,
Will the link <A href=..> in a cell mess up the sort?
I have a page full of Counts (number or empty), it won't sort, not even for column with cells all have numbers.
I have tried the suggestion in "sort-empty-cells.html", it didn't help.
Please see my Script (sorry it's a little bit long), hope you can offer solution
========================================
<SCRIPT LANGUAGE='JavaScript' SRC='/trn/grid.js'></SCRIPT>
<script>
var obj = new Active.Controls.Grid;
var model = obj.getSelectionModel();
function showTransDetail(agt,code){
parent.BottomRptFrame.location.href='.../cgi-bin/realmkt/agentPipeline.cgi?agentid='+agt+'&StageCode='+code;
}
// for sorting Agent#
function string(text){return text};
function numb(text){return Number(text)};
// data source
var myData = [['<A Href="#" onClick="showTransDetail(2001,999)">Total</A>', '<A Href="#" onClick="showTransDetail(2001,20)">1</A>', '<A Href="#" onClick="showTransDetail(2001,30)">8</A>', '<A Href="#" onClick="showTransDetail(2001,40)"></A>', '<A Href="#" onClick="showTransDetail(2001,50)">11</A>', '<A Href="#" onClick="showTransDetail(2001,60)">10</A>', '<A Href="#" onClick="showTransDetail(2001,70)"></A>'],[ '<A Href="#" onClick="showTransDetail(1000,999)"> 1000</A>', '<A Href="#" onClick="showTransDetail(1000,20)">0</A>', '<A Href="#" onClick="showTransDetail(1000,30)">2</A>', '<A Href="#" onClick="showTransDetail(1000,40)">0</A>', '<A Href="#" onClick="showTransDetail(1000,50)">0</A>', '<A Href="#" onClick="showTransDetail(1000,60)">2</A>', '<A Href="#" onClick="showTransDetail(1000,70)">0</A>' ],[ '<A Href="#" onClick="showTransDetail(1001,999)"> 1001</A>', '<A Href="#" onClick="showTransDetail(1001,20)">1</A>', '<A Href="#" onClick="showTransDetail(1001,30)">1</A>', '<A Href="#" onClick="showTransDetail(1001,40)">0</A>', '<A Href="#" onClick="showTransDetail(1001,50)">2</A>', '<A Href="#" onClick="showTransDetail(1001,60)">2</A>', '<A Href="#" onClick="showTransDetail(1001,70)">0</A>' ],[ '<A Href="#" onClick="showTransDetail(1002,999)"> 1002</A>', '<A Href="#" onClick="showTransDetail(1002,20)">0</A>', '<A Href="#" onClick="showTransDetail(1002,30)">2</A>', '<A Href="#" onClick="showTransDetail(1002,40)">0</A>', '<A Href="#" onClick="showTransDetail(1002,50)">0</A>', '<A Href="#" onClick="showTransDetail(1002,60)">2</A>', '<A Href="#" onClick="showTransDetail(1002,70)">0</A>' ],[ '<A Href="#" onClick="showTransDetail(2025,999)"> 2025</A>', '<A Href="#" onClick="showTransDetail(2025,20)">0</A>', '<A Href="#" onClick="showTransDetail(2025,30)">1</A>', '<A Href="#" onClick="showTransDetail(2025,40)">0</A>', '<A Href="#" onClick="showTransDetail(2025,50)">0</A>', '<A Href="#" onClick="showTransDetail(2025,60)">0</A>', '<A Href="#" onClick="showTransDetail(2025,70)">0</A>' ],[ '<A Href="#" onClick="showTransDetail(2028,999)"> 2028</A>', '<A Href="#" onClick="showTransDetail(2028,20)">0</A>', '<A Href="#" onClick="showTransDetail(2028,30)">0</A>', '<A Href="#" onClick="showTransDetail(2028,40)">0</A>', '<A Href="#" onClick="showTransDetail(2028,50)">4</A>', '<A Href="#" onClick="showTransDetail(2028,60)">0</A>', '<A Href="#" onClick="showTransDetail(2028,70)">0</A>' ],[ '<A Href="#" onClick="showTransDetail(2032,999)"> 2032</A>', '<A Href="#" onClick="showTransDetail(2032,20)">0</A>', '<A Href="#" onClick="showTransDetail(2032,30)">1</A>', '<A Href="#" onClick="showTransDetail(2032,40)">0</A>', '<A Href="#" onClick="showTransDetail(2032,50)">2</A>', '<A Href="#" onClick="showTransDetail(2032,60)">0</A>', '<A Href="#" onClick="showTransDetail(2032,70)">0</A>' ],[ '<A Href="#" onClick="showTransDetail(2033,999)"> 2033</A>', '<A Href="#" onClick="showTransDetail(2033,20)">0</A>', '<A Href="#" onClick="showTransDetail(2033,30)">1</A>', '<A Href="#" onClick="showTransDetail(2033,40)">0</A>', '<A Href="#" onClick="showTransDetail(2033,50)">0</A>', '<A Href="#" onClick="showTransDetail(2033,60)">4</A>', '<A Href="#" onClick="showTransDetail(2033,70)">0</A>' ],[ '<A Href="#" onClick="showTransDetail(2475,999)"> 2475</A>', '<A Href="#" onClick="showTransDetail(2475,20)">0</A>', '<A Href="#" onClick="showTransDetail(2475,30)">0</A>', '<A Href="#" onClick="showTransDetail(2475,40)">0</A>', '<A Href="#" onClick="showTransDetail(2475,50)">2</A>', '<A Href="#" onClick="showTransDetail(2475,60)">0</A>', '<A Href="#" onClick="showTransDetail(2475,70)">0</A>' ],[ '<A Href="#" onClick="showTransDetail(2477,999)"> 2477</A>', '<A Href="#" onClick="showTransDetail(2477,20)">0</A>', '<A Href="#" onClick="showTransDetail(2477,30)">0</A>', '<A Href="#" onClick="showTransDetail(2477,40)">0</A>', '<A Href="#" onClick="showTransDetail(2477,50)">1</A>', '<A Href="#" onClick="showTransDetail(2477,60)">0</A>', '<A Href="#" onClick="showTransDetail(2477,70)">0</A>' ]];
var cols = ['AgentId', 'Applied', 'Pre-Approved', 'Approved', 'Closing Scheduled', 'Closed', 'Sold to Investor'];
// create grid object
var row = new Active.Templates.Row;
// row.setEvent("ondblclick","showAgentInfo()");
obj.setTemplate("row", row);
// set number of columns/rows
obj.setColumnTexts(cols);
obj.setColumnCount(7);
obj.setRowCount(10);
obj.setDataText('-');
// link to cell text
obj.setDataText(function(i,j){return myData[i][j]});
var toValue = [string, numb, numb, numb, numb, numb, numb];
// set data value to converted text
obj.setDataProperty("value", function(i,j){
return toValue[j](myData[i][j]);}
);
// write control to the page
document.write(obj);
</script>
<style>
.active-controls-grid {height: 86%; font: menu;}
.active-templates-header { color: blue; border-right: 1px solid orange}
.active-templates-item { text-align: right; color: blue; }
.active-row-cell {border-right: 1px dotted #99ccff}
.active-scroll-top .active-box-item {background: #ccff99}
.active-scroll-left .active-box-item {background: #ffcc99}
.active-scroll-corner .active-box-item {background: #99ffcc}
.active-column-0 {width: 70px; font: bold;middle; text-align: left;}
.active-column-1 {width: 85px; font: bold; text-align: center;}
.active-column-2 {width: 90px; font: bold; text-align: center;}
.active-column-3 {width: 75px; font: bold; text-align: center;}
.active-column-4 {width: 110px; font: bold; text-align: center;}
.active-column-5 {width: 75px; font: bold; text-align: center;}
.active-column-6 {width: 130px; font: bold; text-align: center;}
</style>
Bruce Y
September 23,