How do I use jQuery sortable?

I'm a Ruby on Rails developer and I don't like to use jquery-ui. Am I wrong?

  • I use jquery all the time. I wouldn't build a site without it. But jquery-ui seems to add too much javascript to the application. I feel like it's not really needed and ends up making the code under-tested and over-complicated. So when people suggest it, I push back and recommend just creating divs and building the ui with html/css and straight jquery. Am I missing out? Should I embrace it?

  • Answer:

    As others have said, jQuery UI is more of a UI library than anything else. It benefits from some good practices (e.g., compiling a minified package of only the components you need), and using the jQuery plugin interface, but the library itself doesn't feel complete - components are missing and not fleshed out. Attempting to customize the plugins is also kind of a pain; as you say, the library tries to be comprehensive, which doesn't help when you're just trying to tweak the one or two things you're using. What jQuery UI is great for is rapid prototyping of UI's in code - it's easy to drop in a dialog or a slider just to get the general look-and-feel of an interface, then reimplement it yourself using a similar (coding) interface.

Allen Cheung at Quora Visit the source

Was this solution helpful to you?

Other answers

jQueryUI has always been the ugly stepchild of jQuery. As a UI library its adoption has benefited from its association with the jQuery name, but although its gotten better over the last year, its controls are still far from best in class. The thing to remember is that jQuery is a selector engine, you can pair it with whatever UI library you please. There's nothing to stop you from mixing and matching jQuery plugins, or even using something like YUI. There's no law that says your user interface library needs to internally use your preferred selector engine. Find the best of breed controls for your tasks and implement or adapt those. If you always roll your own you're missing out on the benefits of "standing on the shoulders of giants" Some problems have already been thoroughly solved. For example programmers the world over have spent hundreds of thousands of hours creating their own calendar controls, there's no reason to create yet another one.

Chris Lukic

jQuery UI definitely makes things easier and is a fairly decent (and accessible) way to do it.  It depends on how complex your needs are.  If you need simple interactions, then jQuery and some glue will probably do the trick.  But, if you're doing accordions, tabs, sliders, etc, then I'd use jQuery UI, Dojo's UI stuff or maybe YUI.  It's up to you and how much code you want to write and maintain yourself.  I've been using jQuery-UI on my latest project, but providing my own CSS for them, which has made integration a lot easier, and I've been much happier with the result than the default styles and themes jQuery UI provides.

Kevin Lawver

No, you shouldn't.  If you are more comfortable making your own UI and behaviour, by all means, do that.  Using Rails does not presume using jquery-ui, or even jquery for that matter. Use the tools you are most comfortable using for the job.

Glenn Goodrich

you could look at http://www.sproutcore.com/ which, like jQueryUI, is also built on top of jQuery.  However, you will find it to be more javaScript intensive not less.

John Stark

If you "plug and play" jQuery UI, it does not feel "native" to your app. If you customize it extensively, the overhead is not worth it by any means. Personally, I run through the source code, the css and the examples, seeing how they do it and what edge cases they prepare for. Then i write my own with purely the things i need. In essence, i treat jQ-UI more as a "tutorial" than a library

Anonymous

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.