only last row modified is returned from getSelectedRows function
In this example, user modified cell data on several rows and selector checkboxes were checked, when "show selected" button is pressed, it shows row id for just one (last) row.
Please advise. Thanks. RC
The example is cloned from "multi row marker.htm":
<html><head><title>ActiveWidgets Examples</title>
<script src="../../runtime/lib/aw.js" type="text/javascript"></script>
<link href="../../runtime/styles/system/aw.css" rel="stylesheet">
<style type="text/css"> #myGrid {height: 150px}</style>
</head>
<body>
<span id="myGrid"></span><br>
<input type='button' onclick='alert(grid.getSelectedRows());' value='show selected'>
<script type="text/javascript">
var grid = new AW.UI.Grid;
grid.setId("myGrid");
grid.setColumnCount(5);
grid.setRowCount(20);
grid.setCellData(function(col, row){return "cell " + col + "." + row});
grid.setSelectorVisible(true);
grid.setSelectorTemplate(new AW.Templates.CheckedItem);
grid.onRowSelectedChanged = function(value, i) { this.getSelectorTemplate(i).refresh(); }
grid.onCellValidating = function(text, col, row) { return fSelectRow(text, col, row); }
for (var i = 1; i < grid.getColumnCount(); i++) {
grid.setCellTemplate(new AW.Templates.Input, i);
grid.setCellEditable(true,i);
}
grid.refresh();
function fSelectRow(text, col, row) {
grid.getSelectorTemplate(row).setStateProperty("selected", true);
}
</script>
</body>
</html>
Please advise. Thanks. RC
The example is cloned from "multi row marker.htm":
<html><head><title>ActiveWidgets Examples</title>
<script src="../../runtime/lib/aw.js" type="text/javascript"></script>
<link href="../../runtime/styles/system/aw.css" rel="stylesheet">
<style type="text/css"> #myGrid {height: 150px}</style>
</head>
<body>
<span id="myGrid"></span><br>
<input type='button' onclick='alert(grid.getSelectedRows());' value='show selected'>
<script type="text/javascript">
var grid = new AW.UI.Grid;
grid.setId("myGrid");
grid.setColumnCount(5);
grid.setRowCount(20);
grid.setCellData(function(col, row){return "cell " + col + "." + row});
grid.setSelectorVisible(true);
grid.setSelectorTemplate(new AW.Templates.CheckedItem);
grid.onRowSelectedChanged = function(value, i) { this.getSelectorTemplate(i).refresh(); }
grid.onCellValidating = function(text, col, row) { return fSelectRow(text, col, row); }
for (var i = 1; i < grid.getColumnCount(); i++) {
grid.setCellTemplate(new AW.Templates.Input, i);
grid.setCellEditable(true,i);
}
grid.refresh();
function fSelectRow(text, col, row) {
grid.getSelectorTemplate(row).setStateProperty("selected", true);
}
</script>
</body>
</html>
September 20,