Opened 10 years ago

Closed 10 years ago

#9882 closed enhancement (fixed)

Grid Selection needs a method for simply setting the currently selected row(s)

Reported by: Phil DeJarnett Owned by: Nathan Toone
Priority: low Milestone: 1.4
Component: DojoX Grid Version: 1.3.2
Keywords: grid selection Cc:
Blocked By: Blocking:

Description

Currently, if you want to set the selected rows in a Grid, you have to:

  1. Manually clear all of the items
  2. Loop over each new row
  3. Select that row

The problem is this can generate a lot of events (one for clearing, and one for each selected row).

I think a simple setSelectionTo([rows]) method would be very useful:

setSelectionTo: function(rows) {
    if(!dojo.isArray(rows)) {
        rows = [ rows ];
    }
    this._beginUpdate();
    this.deselectAll();
    dojo.forEach(rows, this.addToSelection, this);
    this._endUpdate();
}

Change History (2)

comment:1 Changed 10 years ago by Nathan Toone

Milestone: tbd1.4
Owner: changed from Bryan Forbes to Nathan Toone

Already exists - call grid.selection.setSelection

comment:2 Changed 10 years ago by Nathan Toone

Resolution: fixed
Status: newclosed

(In [20269]) Fixes #9882 - add support for passing arrays to setSelection, deselect, addToSelection, and toggleSelection !strict

Note: See TracTickets for help on using tickets.