I have a DataGrid and want a user to select multiple items and click a button to do something with those items (such as delete). When only a few items are selected, the deleting works, but if the user selects all the items without scrolling slowly over them, some of the selected items are null.
I also tried grid.removeSelectedRows(), but that also doesn't work for non-loaded items.
I tried fetching first, too:
grid.store.fetch({count:grid.rowCount,onComplete:dojo.hitch(this,function(){
  var items = grid.selection.getSelected();
  grid.selection.clear();
  if (items.length) {
    dojo.forEach(items, function(selectedItem) {
      if (selectedItem !== null) {
        grid.store.deleteItem(selectedItem); //or do something else
      }
    });
  }
  grid.sort();
})});
Even with the fetch, there are still null items, and only the very top and bottom rows actually get deleted.
Is there a way to load the selected items in a grid?