3.2.0

Table doesn't refresh automatically after deleteRow

Using AW 2.6.0 w/ FF 15.0.1 and Chrome 21.0.1180.89

I have the following code which calls deleteRow on obj which is global instance of AW.Grid.Extended. I remember this code working without any issues before upgrading to 2.6.0. Now the problem is sometimes the grid doesn't refresh automatically after deleteRow has been called i.e., the deleted rows are still shown in the grid; one has to reload the entire page or sort on a column to force the deleted rows to disappear. Is this a possible bug in AW 2.6.0 or do I have to call some other function to refresh the grid? In the past I have noticed grid refresh taking a long time for 10,000 records or so.

<!-- ActiveWidgets post-processing after index is deleted -->
<script type="text/javascript">
    <% if @indexes_deleted && !@indexes_deleted.empty? -%>
    indexes_deleted_csv = '<%= @indexes_deleted.join(",") -%>';
    var indexes_deleted = indexes_deleted_csv.split(',');
    var index = '<%= params[:index] -%>';
    var row_to_delete = []
    var row_indexes = obj.getRowIndices();
    if( indexes_deleted && indexes_deleted.length > 0 && obj && index && (index.length > 0)) {
      var j;
      for(j=0; j<obj.getRowCount(); j++) {
        indexes_deleted.every(function(i){
          var key = obj.getCellText(selectorValueColumnIndex,row_indexes[j]).unescapeHTML();
          if( selectorValueColumnIndex > 1) {
            if( key == (i+'+'+index)) {
              row_to_delete.push(row_indexes[j]);
            }
          } else {
            if( key == index) {
              row_to_delete.push(row_indexes[j]);
            }
          }
          return true;
        });
      }
      //alert('rows_to_delete = ' + row_to_delete);
      row_to_delete.every(function(i){obj.deleteRow(i);return true;});
      obj.setSelectedRows([]);
      obj.setCurrentRow(-1);
    }
  <% end -%>
</script>
svhyd
September 19,
Would like to add that, the above code is sent to the browser to run and update the grid after the delete operation was successful on the server.
svhyd
September 19,
Calling obj.refresh() explicitly after deleteRow seems to fix the problem - but isn't AW do this on its own? But I'm not sure if refresh is being called twice in this case (one implicit and other by me). With earlier versions of AW (2.0) didn't have to do this.
svhyd
October 2,
I cannot reproduce this. When I call deleteRow() the row disappears - you don't have to explicitly call refresh().

Maybe you have an event handler attached to either onRowIndicesChanged, onRowCountChanged, onCurrentRowChanged, onSelectedRowsChanged and this event handler produces an exception?
Alex (ActiveWidgets)
October 12,
obj.onRowDeleted = function(aValue){
alert("Inside onRowDeleted");
}

I tried the above today and do see an alert on the screen. So I guess that rules out there was any exception?

After some more examination, it looks like no matter what row is deleted, it is the last row of the grid that disappears (this is without the call to refresh). Which explains why the problem doesnÂ’t happen with the last row itself.

With the call to refresh() following deleteRow however, the last row reappears and the desired column gets deleted from screen. Let me know if you have any other ideas.
svhyd
December 20,

This topic is archived.

See also:


Back to support forum