PDA

View Full Version : CellEditing plugin, bug when i istantiate more than one view



American horizon
15 Jun 2016, 12:14 AM
I've a grid panel with editable cells. I create this panel dynamically and i can have more than one instance at time.
So, when i launch it the first time all works fine, but when i create another window (with the same editable grid), and i try to click a cell, the plugin seems to go crazy. I errors insite the console, and the editable grid don't work properly.

This is the code of my panel:








Ext.define('CS.view.RecapitiList' ,{
extend: 'Ext.grid.Panel',
alias: 'widget.recapitilist',
width:800,
height: 400,
//cls: 'custom-dirty',
title: 'Recapiti',

tbar: [
{
xtype: 'button',
icon: './images/dd/drop-add.gif',
text: 'Nuovo Recapito',
name: 'btnNewRecapito'
},
{
xtype: 'button',
icon: './images/extras/trash_delete.gif',
text: 'Elimina Recapito',
name: 'btnDeleteRecapito'
}
],

bbar: {
layout: {
pack: 'center',
type: 'hbox',
},
items:
{
xtype: 'button',
icon: './images/extras/floppy.png',
text: 'Conferma Recapiti',
name: 'btnSendRecapiti',
}

},

columns: [
{
header: 'ID',
dataIndex: 'id',
flex: 1,
editor: {
allowBlank: true
}
},
{
header: "Tipo Recapito",
name:"idTipoRecapito",
dataIndex: "idTipoRecapito",
alias: "tipoRecapito",
editor: new Ext.form.field.ComboBox({
typeAhead: true,
triggerAction: 'all',
selectOnTab: true,
store: [
['Shade','Shade'],
['Mostly Shady','Mostly Shady'],
['Sun or Shade','Sun or Shade'],
['Mostly Sunny','Mostly Sunny'],
['Sunny','Sunny']
],
lazyRender: true,
listClass: 'x-combo-list-small'
})
},
{
header: 'Valore',
dataIndex: 'valore',
flex: 1,
editor: {
allowBlank: true
}
},
{
header: 'Utente Creazione',
dataIndex: 'idUtenteCreazione',
flex: 1,
editor: {
allowBlank: true
}
},
{
header: 'Data Creazione',
dataIndex: 'dataCreazione',
flex: 1,
editor: {
allowBlank: true
}
},
{
header: 'Utente Modifica',
dataIndex: 'idUtenteModifica',
flex: 1,
editor: {
allowBlank: true
}
},
{
header: 'Data Modifica',
dataIndex: 'dataModifica',
flex: 1,
editor: {
allowBlank: true
}
},
],



initComponent: function() {

this.store= Ext.create("CS.store.Recapiti"),

this.callParent(arguments);
},
plugins: [
Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
})
],
listeners : {
//itemdblclick: function(dv, record, item, index, e) {
// Ext.ComponentQuery.query('titolarilist')[0].fireEvent("dbClickRow");
}


});

alexander.urban
15 Jun 2016, 3:49 AM
Could you please put the code exhibiting the problem into a sencha fiddle, and tell us what exactly the problem is (screenshot?)? Furthermore, the browser and ExtJS version would be useful - I remember there was some "bug" with newer browsers in older versions (4.2.1) that was fixed in update release (4.2.4).

jdkhamba
15 Jun 2016, 4:14 AM
Seems to work fine:

https://fiddle.sencha.com/#fiddle/1c2o

Can you post a working fiddle to demonstrate your issue?

American horizon
15 Jun 2016, 11:28 PM
After some searches, i found that the problem is that i istantiate the celleditor inside "plugins" attribute that is shared beteween all instances of the gridpanel
Solved placing it into init function of the component, in order to associate specific instance of the plugin to its own instance of gridpanel.


initComponent: function() {
this.items = [{
xtype: 'grid',
store: Ext.create("CS.store.Recapiti"),
height: 400,
plugins: [Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
})],

.....
.....