xCodeZone
xCodeZone

Reputation: 194

Dojo: dependent combo box error

I'm fairly new to dojo and have invested quite a bit of time on the below problem, but no luck yet.

initDc : function() {

        new Select({
            onChange: function(data) {

                //call initSd  here

            }
        }).placeAt(this.Sdc);   
},


initSd : function() {

        new Select({
            onChange: function(data) {

            }
        }).placeAt(this.Sds);
},

I want to call initSd inside onChange of initDc new Select, but so far I just end up with undefined , or not a function errors. Any pointer how to proceed with the above would be deeply appreciated. If you need further details, please let me know.

Note: Both the combo boxes are already containing data and I've written the logic for data mapping, but I'm stuck at binding these 2 boxes together.

Upvotes: 0

Views: 34

Answers (1)

xCodeZone
xCodeZone

Reputation: 194

I've made use of lang.hitch and it worked.

initDc : function() {

    var initSd = lang.hitch(this, this.initSd );

    new Select({
        onChange: function(data) {

            //call initSd  here
            initSd();

        }
    }).placeAt(this.Sdc);       

},


initSd : function() {

    new Select({
        onChange: function(data) {

        }
    }).placeAt(this.Sds);

},

Upvotes: 1

Related Questions