Gonath
Gonath

Reputation: 82

qooxdoo : Extend class

I'm trying to extend a class "qx.ui.splitpane.Pane()" :

qx.Class.define("myProject.Pages.Management",{

   extend : qx.ui.splitpane.Pane(),

   construct : function(){
       this.base(arguments);
   },

   members : {

   }
});

However, when I create an object based on this new class and add it to my main contenair, I obtain a javascript error : "Uncaught TypeError: undefined is not a function"

var page = new myProject.Pages.Management();
mainContainer.add(page, {flex : 1});

I tried to directly create an objet from the master class and add it to the main container and everything work :

var page = new qx.ui.splitpane.Pane();
mainContainer.add(page, {flex:1});

Ideas are welcome ! Thanks in advance.

Upvotes: 0

Views: 274

Answers (1)

user625488
user625488

Reputation: 414

Here's a simple unit test that illustrates what might be your problem:

qx.Class.define("one.simple.BadSyntaxTest",
{
    extend : qx.dev.unit.TestCase,
    include: [qx.dev.unit.MMock],

    members :
    {
        "test: 00. extends clause should not be function call": function()
        {
            qx.Class.define("my.test.ObjectType", {
                extend: qx.core.Object(),
                members: {
                }
            });
            var stupidObject = new my.test.ObjectType();
        }
    }
});

It fails. If you replace

                extend: qx.core.Object(),

with

                extend: qx.core.Object,

it passes.

Upvotes: 2

Related Questions