Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Class inheritance problem

$
0
0
Hi Isomorphic,

I found something very strange concerning smart client class inheritance.

Sample codes are tested under

SmartClient LGPL Edition V9.1 (2014-07-06 nightly)
IE 10.0.17
Chrome 35.0.1916.153 m

Code:

isc.defineClass( 'Test1', 'ListGrid' );
isc.Test1.addProperties({
        left: 500,
        dataSource: isc.DataSource.create({
                owner: null
        }),
       
        initWidget: function( args ){                           
                this.Super( 'initWidget', args );
               
                this.dataSource.owner = this;
        },
       
        doTest: function(){
                console.log( this.getClassName() + ' / ' + this.dataSource.owner.getClassName() );
        }
});

isc.defineClass( 'Test2', 'Test1' );
isc.Test2.addProperties({
        left: 400
});

function fnTest1(){
       
        var test1 = isc.Test1.create({});
        test1.doTest();
       
        var test2 = isc.Test2.create({});                       
        test2.doTest();
}

function fnTest2(){
       
        var test1 = isc.Test1.create({});       
        var test2 = isc.Test2.create({});
       
        test1.doTest();
        test2.doTest();
}

1. fnTest1() runs exactly as expected.
Test1 / Test1
Test2 / Test2

2. fnTest2() runs different while there is no logical difference.
Test1 / Test2
Test2 / Test2

Any workarounds ?
thanks.

Veritas

Viewing all articles
Browse latest Browse all 4756

Trending Articles