This week's giveaway is in the JDBC forum.
We're giving away four copies of Java Database Connections & Transactions (e-book only) and have Marco Behler on-line!
See this thread for details.
Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Drag and drop fail when called via ajax  RSS feed

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,
I have two pages with the similar codes. One is here http://183.78.169.53/tm/addTyreSwap1.php in this page you have select the vehicle via the drop down list then a number of tyre will appear via the ajax call. The problem is that both the draggable and droppable is attached to it but is not working. On the other hand I have another page http://183.78.169.53/tm/getTyreLayoutDetails1.php?l=3 here which directly generate the tyre layout and both drag n drop works perfects fine. Both are using the same codes. Only one is via ajax. Any idea why it fails in ajax? To my suprise both pages have the same coding. A snippet of codes is below. But when I go through the output the first page is <span class=“droppable”> and second generates this <span class=“droppable ui-droppable”>. My guess for the solution is reassign the drag and drop the new data after ajax call which is where I am stuck any idea? I do not know how to use the live function here.

 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you calling the code that initializes the click events after you add the content to the page?

I am guessing you are registering the draggables and such before the elements they are added to the page. They do not magically hook themselves up when you dynamically add them.

Eric
 
sukbir frwa
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Eric,
No I am not doing after added the elements to the page. Here is where I stuck how to assign the draggable and droppable again to item. I guess is there ready because back in my php code I have put them but is not functioning either. Any help please?

Eric Pascarello wrote:Are you calling the code that initializes the click events after you add the content to the page?

I am guessing you are registering the draggables and such before the elements they are added to the page. They do not magically hook themselves up when you dynamically add them.

Eric

 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are not doing it, you need to do it.

On the success callback, call the JavaScript code to initialize it.

Eric
 
sukbir frwa
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Eric,
Can you show me some snippet of code on how to achieve this?

I have tried this but fail too.





Eric Pascarello wrote:If you are not doing it, you need to do it.

On the success callback, call the JavaScript code to initialize it.

Eric

 
sukbir frwa
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Eric,
I am doing something like this is it ok.



sukbir frwa wrote:Dear Eric,
Can you show me some snippet of code on how to achieve this?

I have tried this but fail too.





Eric Pascarello wrote:If you are not doing it, you need to do it.

On the success callback, call the JavaScript code to initialize it.

Eric

 
I child proofed my house but they still get in. Distract them with this tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!