Hello! Im very limited in my skills with html/JS/CSS and can only understand the concept of the varius coding but ot much more than that. Now i really need a sortable table like the one you can find on this site: http://www.xn--lnapengarna-x8a.nu/sm%C3%A5-l%C3%A5n Has anyone come across a tutorial or similar on how to build stuff like this? Or have any other hints for me to get started with? Any help is much appriciated
There are a number of free table sorting and filtering Javascripts out there. All you have to do is include the JS file and it will attach itself to existing tables. Find one of them and look at the code to see how it works. If you want to really see how it works, find one that does not rely on jQuery.
There are a number of tutorials available online. I seriously suggest you learn to do basic stuff like sorts in plain javascript before you start using libraries such as jQuery. To use jQuery et alia, you really need to know enough to strip the library down and reconstitute it for your particular purpose. Otherwise you're dealing with a huge pile of generic code. Fact is, you should build your own libraries of functions you use. Google is indeed your friend. Sorting is easy. Doing it right and bug-free, not so much. Try a few of these tutorials. cheers, gary
True, but if he's working on a real project, then I don't think that reinventing the bicycle would be a good thing. I've been through that and spent countless nights doing the dirty bugfixing job. Furthermore, most CMSs already come with JQuery included. So I think the proper way would be using DataTables or something similar, then rewriting it on a testing ground, not a real project which needs flawless performance.
@Axumata, yeah and there will always be another "real" project and the OP or anyone else that follows your advice will never have a clue. Did you notice I suggested using tutorials? They will cover not just what to do but why. That knowledge is key to providing robust web sites to your clients. I'd wager at least 90% of soi-disant web designers are completely ignorant of what's in those massive jQuery libraries they foist on the sites they deliver, and are completely unable to modify or debug misbehaving functions. It isn't absolutely necessary to become an expert in javascript to develop web sites, but you won't be a fully competent developer if you're not. jQuery is not a replacement for knowledge. It's only a tool, and not always the best one for the job. cheers, gary
Thanks for all of your advice. I completly understand that learning javascript atleast in some fashion would be the best idea for both me and my website, my hopes with my post was to find a more simple solution, now when i start looking at guides etc they are quite overwhelming for me The reason why i wanted this kind of solution was to have a more userfriendly approach on my site. The site is half built right now and for now i only have simple tables with quite long lists. I think im going to read up more on JS in itself and then make a decision on what route to go. Im no developer in anyway and as i said my coding abilities is very very limited. FOr my pages i used wordpress with small html/CSS modifications to get it to do what i want.
It's not likely that any complex problem will have a simple solution. A table sort will have gotchas you have to deal with. Good tutorials will deal with them. My first sort was done after the page, a largish table of numeric and alpha fields, was delivered. Sorting was not a part of the spec, but I thought it would improve the user experience and looked at some tutorials. I spent maybe four hours working through the tute and applying to the table. The sort function allowed the user to click on any heading (or tab to the heading and use the [enter] key) to sort on that field. Another click toggled the the sort from ascending to descending or vice versa. How long ago was that? Not sure, but do know my computer was a 233mH Pentium that came with Win98. That one function only needed to be written once and was easily tweaked for different conditions. cheers, gary