Drag table row to a div with jQuery
One of projects I am working on has a long list of classes in a catalog. These classes are listed on the screen in a table which is sortable and filterable. Users search through these classes trying to find ones that they want to register for, when the find one they can click on the “add to cart” button in that classes row. One of the requirements that I was given for this listing was that users should also be able to drag a row to the cart. jQuery UI’s draggables works very nicely but after doing a quick proof-of-concept test I found that draggables don’t work on on table rows very well. I couldn’t get jQuery UI to drag anything.
If you check out the documentation you will find a option for a “helper”. This option can either be set to a string (‘clone’ or ‘original’) or you can provide a function which returns the helper object. So I wrote up some code to create a div with the selected row in a new table.
helper: function(event){
return $('<div class="drag-cart-item"><table></table></div>')
.find('table').append($(event.target).closest('tr').clone()).end().appendTo('body');
},
Then all you need to do is set up a dropable area that knows how to handle that helper.
('#cart').droppable({
drop: function(event, ui) {
var classid = ui.helper.find('tr').attr('id');
var name = ui.helper.find('.name').html();
$('#cart .selected').append('<li id="'+classid+'">'+name+'</li>');
}
});
jQuery hover with a fade
@rmurphey sent out a question on twitter yesterday that I got interested in.
#jquery on hover, i want to stop a fade, clear the anim queue, and start an opposite fade — what am i doing wrong? http://bit.ly/QykYd
All she wanted to do was use the hover event (which lets you define 2 functions one for the mouseenter event and one for the mouseleave event) and start fading an element when you enter and stop and fade back to normal when you leave. The problem was that her code wouldn’t ever fade back.
Redesign
Finally after many months of me putting it off, I finally sat down and finished designing and slicing my new blog design. Decided to stay with the old dP logo that I design back in college for myself. I had stopped liking the logo for a while but after a few comments about it in the last few months by people I started enjoying it a bit more. There are still some quirks of the wordpress theme that I need to take care of, just realized I never finished implementing the design for the comments, but those are things I can take care of in the next day or so.
Mozy vs. Backblaze – The fight of the online backup
By now everyone knows that backing up is a very important thing to do. Everyone has had your gut sink to your toes after doing something on your computer and realizing you have no way to undo it. Some times its not your fault the OS just ate your file, or the hard drive just died. No matter what you have on your computer most likely you do not want to take the weeks that it would take to recreate everything on you hard drives. And that is why backup has been a hot topic for the last many years. The first thing to come along was the external hard drive backup, which at first was very flaky, but now with things like Time Machine it as become a turn on and forget about it system.
Things iPhone app bug
Just emailed this to Cultured Code because of a bug I was having with their Things app.
I just updated to the Iphone 3.0 OS and also the newest Things app for the iphone that was said to support iphone 3.0. When I open up the iphone app and sync it with the desktop app it opens the sync window on both the iphone and the desktop, goes through the normal process and then when the desktop sync window goes away the iphone is still sitting there syncing. I can let it sit there forever and it will never finish.
Things (Mac): 1.1.2 (941)
Things (iPhone/iPod touch): 1.3.7
I got this response about 5 min later. (very nice turn around time!)
To many tweets!
Twitter has really taken off in that pass 6 months. People are signing up like crazy and new tools are popping up like crazy. People are following thousands of others and are trying to find the best way to manage all those tweets. TweetDeck has become one of the leaders as a desktop tool to view all the tweets you are following. The abbility to split the tweets up in to different groups / columns makes it far easier to organize the tweets you really want to read.