:: Forum >>

onSelectedRowsChanged Bug in 2.0.1?

Hi All,

I'm having a issue in 2.0.1 that I can't seem to find in the forums. The issue is when you have two grids on a page, and the first grid has an onSelectedRowsChanged function that changes the selection in the second grid, the first grid does not display its selection correctly.

Here is how to reproduce the error:

1. Create a page with 2 grids both with selection mode single-row.

2. Create an onSelectedRowsChanged function on the first grid to set the selection on the second grid.
obj.onSelectedRowsChanged = function() { obj2.setSelectedRows([0]); };

3. Select different rows in grid 1.

Here is a full example:

    <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 -->
        .aw-grid-control {height: 100; 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;}
    var obj = new AW.UI.Grid;
    obj.getCellText = function (i,j) {return i + ',' + j};
    obj.getHeaderText = function (i) {return i };
    obj.onSelectedRowsChanged = function() { obj2.setSelectedRows([0]); };

    var obj2 = new AW.UI.Grid;
    obj2.getCellText = function (i,j) {return i + ',' + j};
    obj2.getHeaderText = function (i) {return i };

Any Ideas?

Mike Graessle
Tuesday, July 25, 2006
Seems that needs a Timeout "break".
obj.onSelectedRowsChanged = function() {
setTimeout(function(){ obj2.setSelectedRows([obj.getSelectedRows()]) ,0})
Tuesday, July 25, 2006

Thanks. The work around works great.
Mike Graessle
Wednesday, July 26, 2006

This topic is archived.

Back to support forum

Forum search