Grid行単位の選択 | ExtJsへの道

Grid行単位の選択

グリッドを編集可能(EditorGrid)にすると、既定値ではセル単位の選択となります。
gridのconfigOptionのselModelをRowSelectionModelに指定することで行単位の選択となります。

// create the Grid
var grid = new Ext.grid.EditorGridPanel({
store: store,
columns: [
{id:'company',header: "Company", width: 160, sortable: true, dataIndex: 'company'},
{header: "Price", width: 75, sortable: true, renderer: 'usMoney', dataIndex: 'price'},
{header: "Change", width: 75, sortable: true, renderer: change, dataIndex: 'change'},
{header: "% Change", width: 75, sortable: true, renderer: pctChange, dataIndex: 'pctChange'},
{header: "Last Updated", width: 85, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}
],
stripeRows: true,
autoExpandColumn: 'company',
height:350,
width:600,
title:'Array Grid',
selModel:new Ext.grid.RowSelectionModel
});