参考documentation
它表明你可以像这样指定选择模型:
默认情况下,网格使用行选择模型,但这很容易自定义,如下所示:
Ext.create('Ext.grid.Panel', {
selType: 'cellmodel',
store: ...
});
或者替代选项是:
Ext.create('Ext.grid.Panel', {
selType: 'rowmodel',
store: ...
});
编辑:
您需要指定Selection Model MODE
Fiddle
Ext.application({
name: 'MyApp',
launch: function() {
var store = Ext.create('Ext.data.Store', {
storeId: 'simpsonsStore',
fields: ['name', 'email', 'phone'],
proxy: {
type: 'ajax',
url: 'data1.json',
reader: {
type: 'json',
rootProperty: 'items'
}
},
autoLoad: true
});
Ext.create("Ext.grid.Panel", {
title: 'Simpsons',
renderTo: Ext.getBody(),
store: Ext.data.StoreManager.lookup('simpsonsStore'),
selModel: new Ext.selection.RowModel({
mode: "SINGLE"
}),
columns: [{
text: 'Name',
dataIndex: 'name'
}, {
text: 'Email',
dataIndex: 'email',
flex: 1
}, {
text: 'Phone',
dataIndex: 'phone'
}],
height: 200,
width: 400,
});
}
});