PDA

View Full Version : Grid panel row editing plugin not working if morn than 1 grid exist in view



mylok
1 May 2014, 11:03 AM
Grid render fine if I comment out plugins codes,
if I uncomment the plugins I got 'Error: Unable to get property 'isComponent' of undefined or null reference'.
is this a bug?

Gary Schlosberg
1 May 2014, 11:27 AM
I haven't heard of a bug like that. Can you please post the plugin code you are commenting out?

mylok
1 May 2014, 12:05 PM
hi Gray, I found it happen when there are morn than 1 grid in the view, the plugin will cause the error.
my custom grid
Ext.define('test.view.myGrid', {
extend: 'Ext.grid.Panel',
alias: 'widget.myGrid',
store: Ext.data.StoreManager.lookup('simpsonsStore'),
columns: [
{ text: '', dataIndex: 'name', flex: 1, align: 'center' },
{ text: 'title', dataIndex: 'title', width: 60, align: 'center', xtype: 'booleancolumn' },
{ text: 'tooltip', dataIndex: 'tooltip', width: 60, align: 'center', xtype: 'booleancolumn' },
{ text: 'Label', dataIndex: 'label', width: 140, align: 'center', editor: 'textfield' },
{ text: 'Maxlength', dataIndex: 'maxlength', width: 70, align: 'center', editor: 'textfield' },
{ text: 'Order', dataIndex: 'displayorder', width: 60, align: 'center', editor: 'textfield' }
],
selType: 'rowmodel',
plugins: [
Ext.create('Ext.grid.plugin.RowEditing', {
clicksToEdit: 1,
pluginId: 'plugin1'
})
],
width: 450,
forceFit: true,
initComponent: function () {
this.callParent(arguments);
}
});

my main view

......
items: [
{
title: 'Project',
items: [
{
xtype: 'myGrid',
itemId: 'id1'
},
{
xtype: 'myGrid',
itemId: 'id2'
}
]
}

Do I missing some setting? Thanks,

jsakalos
1 May 2014, 2:28 PM
If you want more instances of same component you must extend it using initComponent otherwise all complex object go to prototype so they are shared by all instances.

EFTAS_dev
18 Aug 2014, 5:43 AM
Could someone show a working example?


Ext.define('Foobar', {
extend: 'Ext.form.Panel',
alias: 'widget.foobar',
initComponent : function() {
this.foo = Ext.create('Ext.grid.plugin.RowEditing'), {
clicksToEdit: 1
});
this.callParent(arguments);
},


items: [
{
xtype: 'gridpanel',
store: 'store',
columns: [
{ text: 'test', dataIndex: 'test', sortable: false, menuDisabled: true,
editor: {
xtype:'textfield',
allowBlank:false
}},
{
xtype: 'actioncolumn',
itemId: 'deleteUrl',
menuDisabled: true,
align: 'center',
sortable: false,
stopSelection: false,
items: [{
icon : 'path',
stopSelection: false
}]
}
],
plugins: [
this.foo
]
}
...


The above example does not work. Why not and what is the right solution?
?Best regards!

jsakalos
18 Aug 2014, 1:48 PM
This example (http://extjs.eu/ext-examples/#writable-grid) uses cell editing but you can easily change it to row editing.