PDA

View Full Version : listener in grid panel



2 Oct 2012, 9:35 PM
I want to change a value when billable hours value is changed in my editable grid. The above listener is not working.
Here is my code,

{
header : 'Billable Hours',
dataIndex : 'billableHours',
align : 'right',
editor: {
xtype: 'textfield',
allowBlank: false
},
listeners: {
edit: function(editor, edit) {
alert('edit');
}
},
width : 100
}

sword-it
2 Oct 2012, 11:06 PM
Hi,

you can try following code:




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


Ext.create('Ext.grid.Panel', {
title: 'Simpsons',
store: Ext.data.StoreManager.lookup('simpsonsStore'),
columns: [
{header: 'Name', dataIndex: 'name', editor: 'textfield'},
{header: 'Email', dataIndex: 'email', flex:1,
editor: {
xtype: 'textfield',
allowBlank: false
}
},
{header: 'Phone', dataIndex: 'phone'}
],
listeners:{
edit:{
fn:function(editor,e){
alert('hi');
}
}
},
selType: 'cellmodel',
plugins: [
Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
})
],
height: 200,
width: 400,
renderTo: Ext.getBody()
});

3 Oct 2012, 12:26 AM
Thanks,
listener is working properly,
whenever the values are changed the new value is visible instead it is showing old values,
but in the back ground values are being changed.

Should i refresh the grid to get new values? is there any way to refresh the grid??