felipe.duarte
1 Aug 2012, 10:21 AM
Hi all,
I have two plugins attached to a grid and I want to switch between them but extjs 4.1 doesn't work as expected. I have code a little example:
Ext.create('Ext.data.Store', {
storeId: 'simpsonsStore',
fields: ['name', 'release_date', 'shipping_date'],
data: {
'rows': [
{
'name': 'Lisa',
'release_date': '2011-01-04T00:00:00-0300',
'shipping_date': '2012-07-09T03:00:00+0000'}
]
},
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'rows'
}
}
});
Ext.create('Ext.grid.Panel', {
title: 'Simpsons',
store: Ext.data.StoreManager.lookup('simpsonsStore'),
columns: [
{
text: 'Name',
dataIndex: 'name'},
{
text: 'release_date',
dataIndex: 'release_date',
xtype: 'datecolumn',
format: 'Y-m-d',
editor: 'datefield'},
{
text: 'shipping_date',
dataIndex: 'shipping_date',
xtype: 'datecolumn',
format: 'Y-m-d',
editor: 'datefield'}
],
plugins: [Ext.create('Ext.grid.plugin.CellEditing', {
triggerEvent: 'celldblclick',
pluginId: 'cellEdit'
}),
Ext.create('Ext.grid.plugin.RowEditing', {
triggerEvent: 'celldblclick',
pluginId: 'rowEdit'
})],
rowEdit: false,
listeners: {
celldblclick: function(table, td, cellIndex, record, tr, rowIndex) {
if (this.rowEdit) {
this.getPlugin('rowEdit').startEdit(record, 0);
this.rowEdit = false;
} else {
this.getPlugin('cellEdit').startEdit(record, 0);
this.rowEdit = true;
}
//return false;
},
},
height: 200,
width: 400,
renderTo: Ext.getBody()
});
Live code: http://jsfiddle.net/DjrY6/7/
After the second double click the data from grid disappears. Am I doing something wrong? Does anyone have any ideas how to make this work?
I have two plugins attached to a grid and I want to switch between them but extjs 4.1 doesn't work as expected. I have code a little example:
Ext.create('Ext.data.Store', {
storeId: 'simpsonsStore',
fields: ['name', 'release_date', 'shipping_date'],
data: {
'rows': [
{
'name': 'Lisa',
'release_date': '2011-01-04T00:00:00-0300',
'shipping_date': '2012-07-09T03:00:00+0000'}
]
},
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'rows'
}
}
});
Ext.create('Ext.grid.Panel', {
title: 'Simpsons',
store: Ext.data.StoreManager.lookup('simpsonsStore'),
columns: [
{
text: 'Name',
dataIndex: 'name'},
{
text: 'release_date',
dataIndex: 'release_date',
xtype: 'datecolumn',
format: 'Y-m-d',
editor: 'datefield'},
{
text: 'shipping_date',
dataIndex: 'shipping_date',
xtype: 'datecolumn',
format: 'Y-m-d',
editor: 'datefield'}
],
plugins: [Ext.create('Ext.grid.plugin.CellEditing', {
triggerEvent: 'celldblclick',
pluginId: 'cellEdit'
}),
Ext.create('Ext.grid.plugin.RowEditing', {
triggerEvent: 'celldblclick',
pluginId: 'rowEdit'
})],
rowEdit: false,
listeners: {
celldblclick: function(table, td, cellIndex, record, tr, rowIndex) {
if (this.rowEdit) {
this.getPlugin('rowEdit').startEdit(record, 0);
this.rowEdit = false;
} else {
this.getPlugin('cellEdit').startEdit(record, 0);
this.rowEdit = true;
}
//return false;
},
},
height: 200,
width: 400,
renderTo: Ext.getBody()
});
Live code: http://jsfiddle.net/DjrY6/7/
After the second double click the data from grid disappears. Am I doing something wrong? Does anyone have any ideas how to make this work?