PDA

View Full Version : can not fire itemdblclick with 'checkboxmodel'



nukboon
7 Feb 2012, 7:52 AM
this's full code that i config selModel with Ext.selection.CheckboxModel()
i try to test by v4.0.7 - 4.1b2
it's not work but when i removed selModel: sm it's work (itemdblclick not fire)


Ext.create('Ext.data.Store', {
storeId:'simpsonsStore',
fields:['name', 'email', 'phone'],
data:{'items':[
{ 'name': 'Lisa', "email":"lisa@simpsons.com", "phone":"555-111-1224" },
{ 'name': 'Bart', "email":"bart@simpsons.com", "phone":"555-222-1234" },
{ 'name': 'Homer', "email":"home@simpsons.com", "phone":"555-222-1244" },
{ 'name': 'Marge', "email":"marge@simpsons.com", "phone":"555-222-1254" }
]},
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'items'
}
}});

var sm = new Ext.selection.CheckboxModel();
Ext.create('Ext.grid.Panel', {
title: 'Simpsons',
store: Ext.data.StoreManager.lookup('simpsonsStore'),
columns: [
{ header: 'Name', dataIndex: 'name' },
{ header: 'Email', dataIndex: 'email', flex: 1 },
{ header: 'Phone', dataIndex: 'phone' }
],
listeners: {
selectionchange: function(sm){
sm.view.refresh();
console.log('changed');
},
itemdblclick: function(){
//now it's not fire
console.log('itemdblclick worked');
}
},
selModel: sm,
height: 200,
width: 400,
renderTo: Ext.getBody()
});

mitchellsimoens
7 Feb 2012, 8:27 AM
It's firing for me when I double click on a row or the checkbox

nukboon
7 Feb 2012, 8:32 AM
this is my code that not work:

var sm = new Ext.selection.CheckboxModel();

.......
selModel: sm,
listeners: {
scope: this,
itemdblclick: function(){
console.log(this);
}
}

and it work when remove selModel: sm

mitchellsimoens
7 Feb 2012, 8:34 AM
I simply use the grid plugins example and added the itemdblclick listener to the 2nd grid and it worked for me.

nukboon
7 Feb 2012, 8:35 AM
give me your example :)

this full code


Ext.create('Ext.data.Store', {
storeId:'simpsonsStore',
fields:['name', 'email', 'phone'],
data:{'items':[
{ 'name': 'Lisa', "email":"lisa@simpsons.com", "phone":"555-111-1224" },
{ 'name': 'Bart', "email":"bart@simpsons.com", "phone":"555-222-1234" },
{ 'name': 'Homer', "email":"home@simpsons.com", "phone":"555-222-1244" },
{ 'name': 'Marge', "email":"marge@simpsons.com", "phone":"555-222-1254" }
]},
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'items'
}
}});

var sm = new Ext.selection.CheckboxModel();
Ext.create('Ext.grid.Panel', {
title: 'Simpsons',
store: Ext.data.StoreManager.lookup('simpsonsStore'),
columns: [
{ header: 'Name', dataIndex: 'name' },
{ header: 'Email', dataIndex: 'email', flex: 1 },
{ header: 'Phone', dataIndex: 'phone' }
],
listeners: {
selectionchange: function(sm){
sm.view.refresh();
console.log('changed');
},
itemdblclick: function(){
//now it's not fire
console.log('worked');
}
},
selModel: sm,
height: 200,
width: 400,
renderTo: Ext.getBody()
});

nukboon
8 Feb 2012, 8:52 PM
I found solution
remove
sm.view.refresh(); in selectionchange but i don't know why

????