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

  • SEARCH
  • Home
  • 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 459255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T22:45:15+00:00 2026-05-12T22:45:15+00:00

I have a set of items that can be dragged / dropped using Dojo

  • 0

I have a set of items that can be dragged / dropped using Dojo DND, that part has already been implemented and all is working well. The specific question I have is that I’d like to display very different data both in terms of content and visually while the item is being dragged than the initial view of the item, which is what is presently being displayed when the item is being dragged, how do i do this?

  • 1 1 Answer
  • 2 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-12T22:45:15+00:00Added an answer on May 12, 2026 at 10:45 pm

    It seems that you may have already found the solution to your problem, but I thought I would just throw in my $.02.

    What I did was to use a custom “drag avatar” for each drag handle (in the dojo vernacular, the “avatar” is what is displayed while the user is dragging). Here’s a direct snippet from the code:

    for ( var i=0; i<this.cellsTotal; ++i ) {
        // Create the DND source
        var source = new dojo.dnd.Source(
            "drag-handle-container-" + i,
            {copyOnly: true, creator: createAvatar}
        );
        // Add stuff to it
        source.insertNodes(null, [{data: i, type: [this.dnd.classes.handle]}]);
    }
    

    createAvatar is a function callback previously defined something like this:

    var createAvatar = function(item, mode) {
        var node       = dojo.doc.createElement("span");
        node.id        = dojo.dnd.getUniqueId();
        node.itemIndex = parseInt(item.data);
        dojo.addClass(node, "dojoDndItem");
    
        // Creating the drag avatar or the source node?
        if ( mode == "avatar" ) {
            // Create the DOM for the avatar (what is shown while dragging)
        } else {
            // Create the DOM for the source node (the handle for drag initiation)
        }
    
        return {node: node, data: item, type: [context.dnd.classes.avatar]};
    };
    

    Your method works obviously, but this method frees you from having to worry about toggling styles as Dojo will take care of all of the for you.

    p.s.: I hate Dojo DND and its documentation. This took me waaay to long to figure out when I had to do it originally.

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

Sidebar

Related Questions

I have a set of items that can be in various states. I want
I have a set of work items that are completed and I am ready
I have a list of draggable table cells that can be dropped onto a
I have a custom control that has an Items property. I Have applied an
Is there any way to do this? I have a set of items that
Hey. I have a list of items that the user can search. The search
In WinForms, I have to quickly set up a list of items that have
I have set a list of items in a combobox, but when I debug
I have a set of configuration items I need to persist to a human
I have a table with say 1640 items. I set bindingSource.Filter = some filter

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.