hongwenchina
7 Feb 2012, 11:32 PM
BUG: Selection is disabled in grid, when store loads from remote with autoLoad set to false.
if autoLoad set to true, it works. The row can be selected with CheckboxModel
Ext.define('User', {
extend: 'Ext.data.Model',
fields: [
{name: 'firstName', type: 'string'},
{name: 'lastName', type: 'string'},
{name: 'email', type: 'string'}
]
});
var store = Ext.create('Ext.data.Store', {
model: 'User',
proxy: {
type: 'ajax',
url: 'test.json',
reader: {
type: 'json',
root: 'rows'
}
},
autoLoad: false
});
store.load();
var grid = Ext.create('Ext.grid.Panel',{
store: store,
selModel: Ext.create('Ext.selection.CheckboxModel'),
viewConfig : {
forceFit : true
},
columns:[
{
text: "First Name",
dataIndex: 'firstName',
width: 100,
hideable: false,
scope: me
},{
text: "Last Name",
dataIndex: 'lastName',
width: 80,
hideable: false,
scope: me
},{
text: "Email",
width: 40,
dataIndex: 'email',
scope: me
}]
});
and the test.json list following:
{
"count":2,
"rows":[{"firstName":"Aaron1","lastName":"Conran","email":"ttt@sdu.edu.cn"},
{"firstName":"root","lastName":"Spencer","email":"xxxx@sdu.edu.cn"}],
"success":true
}
if autoLoad set to true, it works. The row can be selected with CheckboxModel
Ext.define('User', {
extend: 'Ext.data.Model',
fields: [
{name: 'firstName', type: 'string'},
{name: 'lastName', type: 'string'},
{name: 'email', type: 'string'}
]
});
var store = Ext.create('Ext.data.Store', {
model: 'User',
proxy: {
type: 'ajax',
url: 'test.json',
reader: {
type: 'json',
root: 'rows'
}
},
autoLoad: false
});
store.load();
var grid = Ext.create('Ext.grid.Panel',{
store: store,
selModel: Ext.create('Ext.selection.CheckboxModel'),
viewConfig : {
forceFit : true
},
columns:[
{
text: "First Name",
dataIndex: 'firstName',
width: 100,
hideable: false,
scope: me
},{
text: "Last Name",
dataIndex: 'lastName',
width: 80,
hideable: false,
scope: me
},{
text: "Email",
width: 40,
dataIndex: 'email',
scope: me
}]
});
and the test.json list following:
{
"count":2,
"rows":[{"firstName":"Aaron1","lastName":"Conran","email":"ttt@sdu.edu.cn"},
{"firstName":"root","lastName":"Spencer","email":"xxxx@sdu.edu.cn"}],
"success":true
}