Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. how to add item and notify item double-click of jquery sortable?

how to add item and notify item double-click of jquery sortable?

Scheduled Pinned Locked Moved Web Development
javascripthtmlcsscomdesign
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jun Jin Pyo
    wrote on last edited by
    #1

    i'll make my web page to just like desktop of windows. there are small icons, and they can move by user drag, as you know. so, i plan to use jquery ui, http://jqueryui.com/demos/sortable/display-grid.html[^]. i wonder how to add item dynamically, and notify item double-click. help.

    J 1 Reply Last reply
    0
    • J Jun Jin Pyo

      i'll make my web page to just like desktop of windows. there are small icons, and they can move by user drag, as you know. so, i plan to use jquery ui, http://jqueryui.com/demos/sortable/display-grid.html[^]. i wonder how to add item dynamically, and notify item double-click. help.

      J Offline
      J Offline
      Jules VDV
      wrote on last edited by
      #2

      To add items dynamically, it looks like you would have to add another DOM element and then call the sortable initializer on the entire set of elements again. So you may have a button that adds a dom element to a div container with the id 'sortable'. Then call the method below.

      $( "#sortable" ).sortable();

      For the double click functionality, I would use jQuery's dblclick API. So while you're creating the DOM element above, right before you call sortable(), I would attach a double click handler like so:

      $('#target').dblclick(function() {
      alert('Handler for .dblclick() called.');
      });

      Greenridge Business Systems[Greenridge Business Systems]

      N 1 Reply Last reply
      0
      • J Jules VDV

        To add items dynamically, it looks like you would have to add another DOM element and then call the sortable initializer on the entire set of elements again. So you may have a button that adds a dom element to a div container with the id 'sortable'. Then call the method below.

        $( "#sortable" ).sortable();

        For the double click functionality, I would use jQuery's dblclick API. So while you're creating the DOM element above, right before you call sortable(), I would attach a double click handler like so:

        $('#target').dblclick(function() {
        alert('Handler for .dblclick() called.');
        });

        Greenridge Business Systems[Greenridge Business Systems]

        N Offline
        N Offline
        Not Active
        wrote on last edited by
        #3

        Its unnecessary to add the handler to each element that is added. Use the Live[^] function to have it applied to all elements, now and future.


        I know the language. I've read a book. - _Madmatt

        J 1 Reply Last reply
        0
        • N Not Active

          Its unnecessary to add the handler to each element that is added. Use the Live[^] function to have it applied to all elements, now and future.


          I know the language. I've read a book. - _Madmatt

          J Offline
          J Offline
          Jules VDV
          wrote on last edited by
          #4

          Thanks for that, I've never used that functionality before.

          Greenridge Business Systems

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups