Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7618269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:21:38+00:00 2026-05-31T03:21:38+00:00

I have found that you cannot chain connects with consistent behavior. In the code

  • 0

I have found that you cannot chain connects with consistent behavior. In the code below, the onCustomClick method in the widget is called, but the function that is connected to it does not get called. The workaround I have, is what I have done with onCustomClick2 where I attach the event to an internal method that simply calls the other method. Is there a way to write this code without having to have the internal method?

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Dojo Connect Issue</title>
</head>
<body>

<div id="content"></div>

<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.7/dojo/dojo.js" data-dojo-config="isDebug: true"></script>
<script type="text/javascript">
    require(["dojo/domReady!", "dojo/parser", "dijit/_Widget", "dijit/_Templated"], function(dr, p, w, t) {

        dojo.declare("W1", [w, t], {

            templateString: '<div>Click Me</div>',

            postCreate: function() {
                this.inherited(arguments);
                this.connect(this.domNode, 'onclick', this.onCustomClick);
                this.connect(this.domNode, 'onclick', this._onCustomClick2);
            },

            onCustomClick: function() {
                console.debug('onCustomClick');
            },

            _onCustomClick2: function() {
                this.onCustomClick2();
            },

            onCustomClick2: function() {
                console.debug('onCustomClick2');
            },
        });

        var w = new W1({}, dojo.byId('content'));

        dojo.connect(w, 'onCustomClick', function() {
            console.debug('End Consumer - onCustomClick'); // never gets called???
        });
        dojo.connect(w, 'onCustomClick2', function() {
            console.debug('End Consumer - onCustomClick2');
        });
        w.startup();

    }); 
    </script>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T03:21:40+00:00Added an answer on May 31, 2026 at 3:21 am

    dojo.connect works by redefining the method with a new function which calls the old one (and the method you’re binding to) So based on the order of execution here, postCreate binds to one definition of the onCustomClick method, then the dojo.connect binds to another. Try using the connect signature that would do a lazy lookup of the onCustomClick method: (edited with Craig’s correction)

    dojo.connect(this.domNode, 'onclick', this, 'onCustomClick');

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have found out that ISynchronizeInvoke cannot be used in WPF after having tried
I have found that my HTML is, to be honest, very clunky. Small, simple
I have found that there is generally a singe type or namespace that takes
I have found that how to determine what columns are primary key column of
I have found that I often have to implement some sort of a scheduler
I have found that creating a zip file using the Zip task provided by
We have found that with our memcache some keys tend to be lost. To
I have done various tests and I have found that the jQuery validate function
I am learning ASP.NET MVC now a days and I have found that most
At every company I have worked at, I have found that people are still

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.