View Full Version : How to use 2 extensions together

26 Aug 2009, 5:56 AM
Hi All

I want to use 2 Extensions for my app:

I have got now

Ext.ux.DynamicGridPanel = Ext.extend(Ext.grid.GridPanel, {
// here the code of DynamicGridPanel

then using as ususaly:

var grid = new Ext.ux.DynamicGridPanel({
// here the code of grid

it works

now I need add second extend

//Ext.ux.DynamicGridPanel = Ext.extend(Ext.grid.GridPanel, {
Ext.ux.DynamicGridPanel = Ext.extend(Ext.ux.grid.LockingGridPanel, {
// here the code of DynamicGridPanel

but it doesn't works =(
(all files of Extensions are included correctly)

Please explain me how to do it in good way


26 Aug 2009, 9:13 AM
What you are trying to do is called multiple inheritance. Ext does not support this directly with Ext.extend. The problem with multiple inheritance is when both superclasses implement the same method. How you solve this depends very much on the implementation details of the two classes. I would recommend that you not take this approach.

Try making each extension into a plugin. Then create your grid adding the two plugins to the configuration option.

26 Aug 2009, 9:35 AM
It is probably not possible to use them together.

This is one of the advantages of using plugins which augment an existing class by intercepting certain lifecycle events to add capabilities.

Most plugins can work together, so if someone wrote a DynamicGridInitializer plugin and a ColumnLocking plugin, you might be in luck.

Maybe someone will one day.