How to programmatically select rows in CFGRID with multiselectrow on CF9.01+?

852 Views Asked by At

Why's there ColdFusion.grid.getSelectedRows but no setSelectedRows()?

Doc: Adobe ColdFusion 10 * ColdFusion.grid.getSelectedRows

Then how shall one select rows programmatically???

Sigh... gotta be careful with <cfgrid> before I hit the wall.

1

There are 1 best solutions below

0
On BEST ANSWER

I am not sure about 9.0.1, but in CF10 try selectRange or selectRecords.

var grid = ColdFusion.Grid.getGridObject('myGrid');
var model = grid.getSelectionModel();

model.selectRange(4, 6, false);
// ... or
var records = [grid.store.getAt(10)];
model.selectRecords(records , true);