Ruby-on-Rails
  Home arrow Ruby-on-Rails arrow Page 2 - Dropping and Sorting with AJAX and script....
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Actuate Whitepapers 
Moblin 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
RUBY-ON-RAILS

Dropping and Sorting with AJAX and script.aculo.us
By: O'Reilly Media
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 3
    2007-11-29

    Table of Contents:
  • Dropping and Sorting with AJAX and script.aculo.us
  • Droppables with Ajax
  • Sortables
  • Ajax-enabled sortables

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!

    Dropping and Sorting with AJAX and script.aculo.us - Droppables with Ajax


    (Page 2 of 4 )

    All the options specified in the previous section are available whether you create your droppable with JavaScript (Droppables.add) or the Rails helpers (drop_receiving_elementanddrop_receiving_element_js). However, when created with the helpers, some additional options are available. Namely, all thelink_to_remoteoptions, such asupdate andurl(described in Chapter 3), are also available, and will be used to create anonDropcallback function for doing Ajax calls with droppables. For example:

      <div id="drag" class="green box">drag </div>
      <%= draggable_element :drag, :revert => true %>

      <div id="drop" class="pink box">drop</div>
      <%= drop_receiving_element :drop, :hoverclass => "hover",
           :update => "status", :url => { :action => "receive_drop" } %>

      <div id="status"></div>

    Notice that the:urloption points to areceive_dropaction, so we’ll need to define that in chapter4_controller.rb:

      def receive_drop
        render :text => "you dropped element id #{params[:id]}"
      end

    Unless overridden by the:withoption, thedrop_receiving_elementAjax call will automatically include the ID of the draggable as theidparameter of the request.

    More Ruby-on-Rails Articles
    More By O'Reilly Media


       · This article is an excerpt from the book "Ajax on Rails," published by O'Reilly. We...
     

    Buy this book now. This article is excerpted from chapter four of the book Ajax on Rails, written by Scott Raymond (O'Reilly, 2007; ISBN: 0596527446). Check it out today at your favorite bookstore. Buy this book now.

    RUBY-ON-RAILS ARTICLES

    - Ruby On Rails: Making Your First Dynamic Site
    - Ruby on Rails: Beginning Rails
    - Ruby: Modules, Mixins, Fixins, and Rails
    - Controlling Information Access with the Rail...
    - URLs, Filters and the Rails Action Controller
    - Flash and the Rails Action Controller
    - Rails Action Controller
    - Dropping and Sorting with AJAX and script.ac...
    - Drag and Drop with script.aculo.us and Rails
    - Introducing script.aculo.us
    - Ruby Classes and Objects
    - Ruby Loops
    - Ruby Conditionals
    - Ruby Operators and Arrays
    - Ruby for the Newbie






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway