Awhile back I mentioned how sometimes I get sucked into these science projects,
and I end up not doing more productive things. That particular science
project was me trying to build a drag-and-drop list. Sounds silly,
right? Because there are existing solutions. But I had good intentions.
First off, the ReorderList control
in the ASP.NET AJAX toolkit blows. It has all kinds of problems
selecting stuff as you drag, the rendering forces you in to an
unordered list, and it doesn't have the nice clean movement you see in
other similar pieces around the Internet. The underlying code is
hopelessly complex too, and I'm not sure why it has to be that way.
More on that question in a moment.
My second motivation was just
that, dammit, I want to see if I can do it. I remember the first time I
saw the getBounds method in the AJAX framework, and I immediately
thought it was a key time saver to creating a drag-and-drop list.
what did I manage to do? I managed to do the dragging part, which came
pretty easily. I managed to create a placeholder that lived where the
item was coming from too. At that point, I really only had about a hundred lines of code. This object model that I had come up with,
however, made it exceptionally illogical for altering the list as you
were dragging. All along I already had something in mind for this
control, and at this point I was just wasting time when there were
solutions out there. Really, really good solutions.
Something else recently landed me on the Yahoo UI
page, and I figured I'd give that a good look to see if it would do
what I wanted with minimal pain. For the most part I think it can, but
it wasn't nearly as easy as Scriptaculous.
They use some odd naming conventions (like event handlers being called
"observers"), but for the most part everything is so straight forward.
The code is fairly easy to understand, and definitely has seen many
rounds of refactoring. The Sortable object was exactly what I needed. I looked at JQuery as well, and it looks remarkably similar.
is the ASP.NET AJAX stuff so heavy? It reminds me of so many
server-side controls that try to do everything but succeed at being
useful only a small percentage of the time, primarily for those
old-school line-of-business app developers. Although, does it really
I'm not hating here, let me make that clear. The first
time I wired up server-side stuff to the client-side, and then had two
client-side objects interact, I totally understood why Microsoft's
framework is pretty cool. It's just the stuff being built on top of it
that doesn't seem to be as elegant and useful as I think it should be.
But regardless, it thrills me that these frameworks can live peacefully