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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:45:19+00:00 2026-05-30T02:45:19+00:00

First of all, here is a JSFiddle which has the problem I’m getting. http://jsfiddle.net/UG66K/9/

  • 0

First of all, here is a JSFiddle which has the problem I’m getting.

http://jsfiddle.net/UG66K/9/

Premise:

I have, as you can see, one input box in which you can type filtering parameters on Usernames.

The code also makes all the users support drag & drop with JQuery UI.

After one round of searching something, and then trying to drag the items – everything gets dragged as opposed to just one item being draggable.

What I’m trying to achieve:

I want to filter a list of users, and have all the resulting users be draggable one by one.

Question:

How would I approach this differently to avoid this problem, and in fact – what is causing this problem at the moment?

My hypothesis:

After a search, knockout probably generates a new set of Dom objects for me (while the previous set is still in memory), and I still have some handlers hanging somewhere, and after one round of searching the old handlers start messing with the new ones? I’d still expect the dragging rather to not work at all after the new render has been completed.

Cheers,
Lari

  • 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-30T02:45:21+00:00Added an answer on May 30, 2026 at 2:45 am

    It looks like your selector is hitting the container div for each filtered user, as well as each user. The actual user template only gets rendered the first time, while the foreach area gets re-rendered based on the filter.

    One choice would be to put your afterRender on the foreach like:

    <div data-bind="foreach: { data: filteredItems, afterRender: $root.makeDraggable }">
        <div data-bind="text: Username" />
    </div>
    

    Sample: http://jsfiddle.net/rniemeyer/UG66K/13/

    Otherwise, you can certainly use a simple custom binding to make this happen like:

    ko.bindingHandlers.draggable = {
        init: function(element, valueAccessor) {
           var options = ko.utils.unwrapObservable(valueAccessor()) || {};
           $(element).draggable(options);
        }    
    };
    

    Then, use it like:

    <div data-bind="foreach: filteredItems">
        <div data-bind="text: Username, draggable: { appendTo: 'body', helper: 'clone' }" />
    </div>
    

    Here is a sample: http://jsfiddle.net/rniemeyer/UG66K/12/

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

Sidebar

Related Questions

All of this is code is here: http://jsfiddle.net/yrgK8/ I have a news section which
I have a jQuery animation example here : http://jsfiddle.net/p7Eta/ I would like all the
jquery how to addClass to all the ul.menu li:first.selection ? demo code here: http://jsfiddle.net/NkbDY/
I have a jsfiddle application which you can access here . Now when you
Here is my current code, http://jsfiddle.net/HRZ3D/2/ with it I have been unable to do
I'm having trouble selecting all contents of the div. Here's a demo: http://jsfiddle.net/KcX6A/304/ It's
Greetings to all! This is my first question here on stackoverflow. I have a
I have a jsfiddle application here and I have a problem when it comes
First of all here is my code so that you can test it to
I have: <table> <tr class=here> <td class=first>first</td> <td class=next par=http://google.com>next</td> <td class=next par=http://stackoverflow.com>next</td> </tr>

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.