PDA

View Full Version : [4.1 Beta 2] Selection is disabled in grid, when store loads from remote.



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
}

evant
7 Feb 2012, 11:36 PM
Can't reproduce this using your example. You'll need to provide more info.



Ext.define('User', {
extend: 'Ext.data.Model',
fields: [{
name: 'firstName',
type: 'string'
}, {
name: 'lastName',
type: 'string'
}, {
name: 'email',
type: 'string'
}]
});

Ext.onReady(function() {
var store = Ext.create('Ext.data.Store', {
model: 'User',
proxy: {
type: 'ajax',
url: 'data.json',
reader: {
type: 'json',
root: 'rows'
}
}
});
store.load();

var grid = Ext.create('Ext.grid.Panel', {
renderTo: Ext.getBody(),
store: store,
selModel: Ext.create('Ext.selection.CheckboxModel'),
viewConfig: {
forceFit: true
},
columns: [{
text: "First Name",
dataIndex: 'firstName',
width: 100
}, {
text: "Last Name",
dataIndex: 'lastName',
width: 80
}, {
text: "Email",
width: 40,
dataIndex: 'email'
}]
});
});

// Server
{
"count": 2,
"rows": [
{
"firstName": "Aaron1",
"lastName": "Conran",
"email": "ttt@sdu.edu.cn"
}, {
"firstName": "root",
"lastName": "Spencer",
"email": "xxxx@sdu.edu.cn"
}
],
"success": true
}

hongwenchina
7 Feb 2012, 11:47 PM
Thx for your reply

The grid will works, but the checkbox cannot be checked.

evant
8 Feb 2012, 12:03 AM
As I said, I can't reproduce it: http://screencast.com/t/aPeyQ4bfeHhd

Hoyeol
21 Feb 2012, 8:11 PM
me, too.
checkbox cannot be checked.

xtype: window
animateTarget: not null
Ver. Ext JS 4.1.0 beta 2a

but, animateTarget: null
checkbox can be checked.