Hello, I have a grid with dinamic rows, I 've get buttons to add or remove rows if I need it. The problem is that when I edit a cell using cellediting plugin, after edit the grid is reseted and get empty, what could be happen?. Thanks in advance.
This is my code:

Ext.define('LdCalendarioModel', {
extend: 'Ext.data.Model',
fields: [
'id',
'fb',
'bdk',
'tipo',
'monto',
'fecha',
'ld',
'posicion',
{ name: 'id', type: 'string' },
{ name: 'fb', type: 'string' },
{ name: 'bdk', type: 'string' },
{ name: 'tipo', type: 'string' },
{ name: 'fecha', type: 'date', dateFormat: 'n/j/Y' },
{ name: 'monto', type: 'float' },
{ name: 'ld', type: 'string' },
{ name: 'posicion', type: 'int' }
]
});
var store = Ext.create('Ext.data.Store', {
// destroy the store if the grid is destroyed
autoDestroy: false,
model: 'LdCalendarioModel',
autoload:false,
proxy: {
type: 'memory'
},
data: data,
listeners:{
'add': function(storeCalendar, records,index) {
records[0].set('posicion',index+1);

if(index+1 < storeCalendar.getCount()){
for(var i=index+1; i<storeCalendar.getCount(); i++){
var record = storeCalendar.getAt(i);
record.set('posicion',i+1);
}
}

},
'remove': function(storeCalendar, records,index) {
if(index < storeCalendar.getCount()){
for(var i=index; i<storeCalendar.getCount(); i++){
var record = storeCalendar.getAt(i);
record.set('posicion',i+1);
}
}

}
}
// sorters: [{
// property: 'fecha',
// direction: 'ASC'
// }]
});
var r = Ext.create('LdCalendarioModel', {
id: '',
tipo: '',
fecha: '',
monto: '0',
posicion: '0'
});
// var plugin = grid.getPlugin('ldCalendar');
Ext.define('prestamos.view.v2.ld.LdOtroCalendarioForm', {
extend: 'Ext.grid.Panel',
requires: [
'Ext.grid.*',
'Ext.form.*',
'Ext.layout.container.Column',
'Ext.data.*',
'Ext.util.*',
'Ext.state.*',
// 'Ext.grid.plugin.RowEditing',
'Ext.grid.plugin.CellEditing'
],
alias: 'widget.v2ldotrocalendarioform',
id: 'v2ldotrocalendarioform',
title: 'Calendario',
store: store,
selType: 'cellmodel',
autoScroll: true,
viewConfig : {
getRowClass : function(record, index) {
return 'altofila';
}
},
// plugins: [
// Ext.create('Ext.grid.plugin.CellEditing', {
// clicksToEdit: 1,
// id: 'ldCalendar',
// pluginId: 'ldCalendar'
// })
// ],
plugins: [
{
ptype: 'cellediting',
pluginId: 'ldCalendar',
clicksToEdit: 1,
id: 'ldCalendar',
}
],
columns: [

{header: 'No.', dataIndex: 'id', flex: 0.2, hidden: true},
{
flex: 0.15,
sortable: false,
header: 'Acciones',
renderer: function (v, m, r) {
var idadd = Ext.id();
var idremove = Ext.id();
Ext.defer(function () {
Ext.widget('button', {
renderTo: idadd,
text: '',
iconCls: 'add_small',
width: 15,
height: 15,
handler: function () {
var grid = Ext.getCmp('v2ldotrocalendarioform');
var sm = grid.getSelectionModel();
var index = store.indexOf(sm.getSelection()[0]);
if (!index)
index = 0;
var r = Ext.create('LdCalendarioModel', {
id: '',
tipo: '',
fecha: '',
monto: '0',
posicion: '0'
});
// var plugin = grid.getPlugin('ldCalendar');
store.insert(index + 1, r);
}
});
}, 40);

Ext.defer(function () {
Ext.widget('button', {
renderTo: idremove,
text: '',
iconCls: 'delete_small',
width: 15,
height: 15,
handler: function () {
var grid = Ext.getCmp('v2ldotrocalendarioform');
var sm = grid.getSelectionModel();
// rowEditing.cancelEdit();
if (store) {
// var plugin = grid.getPlugin('ldCalendar');
store.remove(sm.getSelection());
if (store.getCount() > 0) {
sm.select(0);
}
}
}
});
}, 40);

return Ext.String.format('<div id="{0}" style="position: relative; float: left; margin-top: 0.5%;"></div>' +
'<div id="{1}" style="position: relative; float: right; margin-top: 0.5%;"></div>', idadd, idremove);

}
},
{header: 'No.', dataIndex: 'posicion', flex: 0.2, editable: false},
{
header: 'Tipo', dataIndex: 'tipo',
flex: 0.6,
sortable: false,
editor: {
xtype: 'combobox',
name: 'tipo',
store: ['I', 'P'],
queryMode: 'local',
forceSelection: false,
allowBlank: true
}
},
{
xtype: 'datecolumn',
header: 'Fecha',
sortable: false,
dataIndex: 'fecha',
flex: 0.6,
renderer: Ext.util.Format.dateRenderer('F j, Y'),
xtype: 'datecolumn',
editor: {
xtype: 'datefield',
allowBlank: true,
format: 'Ymd'
// minValue: '01/01/2006',
// minText: 'Cannot have a start date before the company existed!',
// maxValue: Ext.Date.format(new Date(), 'm/d/Y')
}
},
{
xtype: 'numbercolumn',
header: 'Monto',
sortable: false,
dataIndex: 'monto',
format: '$0.00',
flex: 0.6,
editor: {
xtype: 'numberfield',
allowBlank: true
// minValue: 0
// maxValue: 150000
}
}
],
tbar: [
{
text: 'Agregar',
iconCls: 'add',
itemId: 'addCalendar',
item: 'addCalendar',
tooltip : "Agregar una entrada",
// action: 'addcalendar'
handler : function() {
// var plugin = Ext.getCmp('ldCalendar');
// plugin.cancelEdit();
// Create a model instance
var r = Ext.create('LdCalendarioModel', {
id: '',
tipo: '',
fecha: '',
monto: '0',
posicion: '0'
});
if(store) {
count = store.getCount();
store.insert(count, r);
}
// plugin.startEdit(0, 0);
}
},
{
itemId: 'removeCalendar',
item: 'removeCalendar',
text: 'Eliminar',
iconCls: 'delete',
disabled: true,
tooltip : "Eliminar una entrada",
// action: 'removecalendar'
handler: function() {
var grid = Ext.getCmp('v2ldotrocalendarioform');
var sm = grid.getSelectionModel();
// rowEditing.cancelEdit();
if(store) {
store.remove(sm.getSelection());
if (store.getCount() > 0) {
sm.select(0);
}
}
},
},
{
itemId: 'backCalendar',
text: 'Atrás',
iconCls: 'previous',
tooltip : "Atrás",
action: 'backcalendar'
},
{
itemId: 'printCalendar',
text: 'Imprimir',
iconCls: 'printer',
tooltip : "Imprimir",
action: 'printcalendar',
hidden: true
}
],
listeners: {
'selectionchange': function(view, records) {
var grid = Ext.getCmp('v2ldotrocalendarioform');
grid.down('#removeCalendar').setDisabled(!records.length);
}
},
// renderTo: ''
});