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 6577041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:35:10+00:00 2026-05-25T15:35:10+00:00

So I asked an earlier question ( Original Question ). I got a great

  • 0

So I asked an earlier question (Original Question). I got a great answer that did exactly what I wanted. However, since I am new to Javascript/Dojo, I wasn’t able to fully understand it, and neither was the answerer of the question.

My question is: How does the following code work?

dndController: function(arg, params){
    return new dijit.tree.dndSource(
        arg,  // don't mess up with the first parameter
        dojo.mixin({}, params, {copyOnly:true}))
           //create a copy of the params object, but set copyOnly to true
}

So the part bugging me the most is the “args” and “params” parameters. I don’t understand where they come from and what they mean or represent. (If there needs to be more context to the code, I can edit the question later, so just post it in the comments). Also, why couldn’t I just use the new dijit.tree.dndSource directly and why did I need to use the function to return it?

Thanks

  • 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-25T15:35:11+00:00Added an answer on May 25, 2026 at 3:35 pm

    Take a look at dijit/Tree.js in the dojo source.

    in Tree.js, inside the postCreate function (which is used by any widget as a part of the dijit lifecycle):

    if(this.dndController){
        if(dojo.isString(this.dndController)){
            this.dndController = dojo.getObject(this.dndController);
        }
        var params={};
        for(var i=0; i<this.dndParams.length;i++){
            if(this[this.dndParams[i]]){
                params[this.dndParams[i]] = this[this.dndParams[i]];
            }
        }
        this.dndController = new this.dndController(this, params);
    }
    

    You’ll see a section which checks what the dndController property is. If it is a string it sets the dndController attribute to the function that creates the class that the string describes (this is what dojo.getObject(string) is doing).

    For example if this.dndController was the string "my.special.dnd.controlller", it would return the function that, when called instantiates a new instance of my.special.dnd.controller.

    It then copies some parameters into an object, followed by executing the function that was either:

    (1) looked up via dojo.getObject

    (2) uses the custom function you passed in.

    I would assume the maintainer of this widget does it this way as some people only need to specify a specific class to use as the dnd controller, whereas others need to do some something more custom based on what parameters the Tree was passed.

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

Sidebar

Related Questions

I earlier asked another question here However, I later realized that my requirements are
I see that the above question was asked earlier, however even after referring them
I asked a question earlier which elicited some great responses. Here's the earlier question
I asked a question earlier , and got an excellent response, but, being a
I asked a question earlier this week and i got this statement as the
I know that this question was asked earlier but the OP didn't get any
I asked a question earlier yesterday and got some very good answers for sure.
The following question is related to a question that I had asked earlier: Help
Sorry folks but I asked a question earlier and perhaps did not explain myself
I had asked an earlier question which did not get any replies. Basically I

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.