:: Forum >>

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>
Friday, September 20, 2013
Modified a cell on a row, then press down arrow three times, check box on each of the three rows is checked, but is checked, but getSelectedRows() returns 3. How do I tell the system to remember that row 0,1,2 were selected?
Friday, September 20, 2013
Answer: run the setcelltemplate statement after setcelldate will fix the problem.
David K.
Sunday, September 22, 2013

This topic is archived.


Back to support forum

Forum search