XML data refresh bug when sorted descending in 2.0.1
I'm having an issue with refreshing XML data in the grid while there is a descending sort in place.
In the following example, if you sort by column 0 ascending and click the "changedata" button, everything works correctly.
But, if you start over and sort by column 0 descending, the grid only shows the data for 2 of the rows. The new grid count is correct, but the data is blank for most rows.
This only seems to happen if the number of rows changes.
Anybody know of a work around?
In the following example, if you sort by column 0 ascending and click the "changedata" button, everything works correctly.
But, if you start over and sort by column 0 descending, the grid only shows the data for 2 of the rows. The new grid count is correct, but the data is blank for most rows.
This only seems to happen if the number of rows changes.
Anybody know of a work around?
<html>
<head>
<title>ActiveWidgets Grid :: Examples</title>
<style> body, html {margin:0px; padding: 0px; overflow: hidden;} </style>
<!-- ActiveWidgets stylesheet and scripts -->
<link href="../../runtime/styles/xp/aw.css" rel="stylesheet" type="text/css" ></link>
<script src="../../runtime/lib/aw.js"></script>
<!-- grid format -->
<style>
.aw-grid-control {height: 200; width: 100%; margin: 0px; border: none; font: menu;}
.aw-row-selector {text-align: center}
.aw-column-0 {width: 80px;}
.aw-column-1 {width: 200px;}
.aw-column-2 {text-align: right;}
.aw-column-3 {text-align: right;}
.aw-column-4 {text-align: right;}
</style>
</head>
<body>
<input type="button" value="changedata" onclick="changeData()" />
<script>
var count = 0;
function getXml(rowCount, extra){
if(!extra){
extra = "";
}
var xml = "<data>";
for(var row=0;row<rowCount;row++){
xml += "<row>";
for(var col=0;col<5;col++){
xml += "<col"+col+">" + extra + + row + ","+ col + "</col"+col+">" ;
}
xml += "</row>";
}
xml += "</data>";
return xml;
}
function getDocumentFromString(xmlString){
// IE
if (window.ActiveXObject) {
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
xmlDoc.loadXML(xmlString);
return xmlDoc;
}
// Mozilla
else {
return new DOMParser().parseFromString(xmlString, "text/xml");
}
}
function changeData(){
table.setXML( getDocumentFromString(getXml(6, "change " + count + " " )) );
count += 1;
obj.setRowCount(table.getCount());
obj.refresh();
}
var obj = new AW.UI.Grid;
obj.getHeaderText = function (i) {return "Column " + i };
var table = new AW.XML.Table;
table.setColumns( ["col0","col1","col2","col3","col4"]);
table.setXML( getDocumentFromString(getXml(10)) );
obj.setCellModel(table);
obj.setRowCount(table.getCount());
obj.setColumnCount(5);
obj.setSelectionMode("single-row");
document.write(obj);
</script>
</body>
</html>
Mike Graessle
August 7,