6 ms·
DataTables – Table plug-in for jQuery
- gesman 13y agoBest thing to make sexy tables since the beginning of time
- dbieber 13y agoI used these when interning at Khan Academy this summer for an internal tool for video creators. Really very easy to get up and running, and looks good to boot.
- debaserab2 13y agoWhile I have found DataTables to be useful in the past, there are (thankfully) many other alternatives available today with a much saner API. DataTables might have the worst API I've ever seen in a Javascript library. Powerful, yes, but it has the most insane naming conventions I've ever seen. To this day I do not understand why so many properties are prefixed with random letters. There was a time when there wasn't anything else out there that was even close to as good, though.
- enigmoid 13y agoI agree with your sentiment. I found datatables initially easy to set up and use, but I soon found the documentation to be sorely lacking. Searches for the most basic customizations led to SO answers outlining ugly workarounds when all I really needed to know was the name of the right flag. The examples on the site aren't general or plentiful enough, and they assume more prior knowledge of the plugin than would seem reasonable. I couldn't even find a list of initialization options anywhere.
- theallan 13y agoA full list of options are available here: http://datatables.net/ref http://datatables.net/ref . However, I totally accept that the documentation isn't up to scratch, which I why I'm working on completely redoing it. I'd be interested to know of any particular pain points you had so I can ensure they are addressed.
- freeasinfree 13y agoAlternatives such as? They use Hungarian Notation[0]; not random, but dated. [0] http://en.wikipedia.org/wiki/Hungarian_notation http://en.wikipedia.org/wiki/Hungarian_notation
- wyuenho 13y agoI wrote this: http://backgridjs.com/ http://backgridjs.com/
- debaserab2 13y agoAh, you're correct. I don't program in any language that considers hungarian notation to be a common naming convention so I haven't ran into it before. For some reason I had not stumbled on to the page that explains this until I deliberately looked for it now. As far as alternatives go, I usually specialize based on what my needs are. If I'm using a JS framework I don't have as much of a need for an all-in-one solution like datatables because the framework usually does a good job of handling things like DOM rendering and data storage without the need for a full blown table sorting library.
- kamjam 13y agoAs far as alternatives go, I usually specialize based on what my needs are. Well, the alternative is always to write it yourself. The same could be said for jQuery or any framework (and many have been advocating doing that) but it's always a trade off between experience/time/resources. I don't think it's really fair to compare a feature rich plugin that provides a lot of generic functionality vs what you can write for a very specific requirement, esp if you don't need the any/most of the functionality in the plugin! I used Datatables a few years ago extensively for a provide, I actually found it very easy to work with - but I understood the notation having come from a VBScript background a long time ago - and as others have said, it was miles ahead of anything else at the time.
- jobowoo 13y agoWhat alternatives have you found to be better? I'd be interested in checking them out.
- kisielk 13y agoI'm not the parent, but we switched from Datatables to SlickGrid: https://github.com/mleibman/SlickGrid https://github.com/mleibman/SlickGrid Much nicer API and it's fast for large amounts of data. Unfortunately like many things it's lacking a lot of docs so you have to dig through the source of the examples.
- scr4ve 13y agoWe finally ended up picking http://dgrid.io/ http://dgrid.io/ over SlickGrid and jqGrid. As with every table component, there are some quirks, but we're really happy with it. Feels like the most modern table component to us.
- shoebappa 13y agoCan you name a few of the alternatives you found? The ability to sort on more than one column ruled out a lot of them for us.
- jonaldomo 13y agohttps://github.com/Mottie/tablesorter https://github.com/Mottie/tablesorter has multiple sorting using the shift key. I alternate between this and DataTables. The hungarian notation threw me off at first too. Far from insane though.
- debaserab2 13y agoHere's an example of what you have to do in datatables to get the elements displayed around the table itself styled (such as a search bar, pagination, or table meta information) https://datatables.net/release-datatables/examples/basic_init/dom.html https://datatables.net/release-datatables/examples/basic_ini... So, in order to adjust the styling of DOM elements around the datatable, you need to understand a very specialized form of syntax that one particular property that controls all DOM element layouts accepts as a string. And there's only one example. How is that sane?
- m_mueller 13y agoI don't find this a problem at all. What's indeed a problem is that it enforces a wrapper div that you cannot control using this syntax. Furthermore, plugins such as ColVis tend to be inflexible due to that wrapper.
- arethuza 13y agoTo control the structure of whats put in the DOM your are going to need something that looks like a template - so it's never going to be pretty and as soon as you choose any approach to templating it's probably going to upset a lot of people. I agree that the syntax is a bit on the terse side - but it's not "insane" and at least it is there, logical and documented.
- debaserab2 13y ago
- m_mueller 13y agoIn typical HN fashion the most cranky post gets voted to the top. - Hungarian notation is 'the most insane naming convention' you have ever seen? Really? I'm guessing you haven't seen a lot. - 'There are many alternatives with a much saner API' - proceeding with not naming any, and the ones mentioned below all are lacking in features compared to DataTables - everything else I've seen tends to be a one trick pony. Obviously something with not many features is going to have a simpler API. Please note: I do agree that the API could be better - also, it depends on how many powerful features you want, whether DataTables is going to be worth it. As someone who usually develops in rich desktop environments I tend to demand more of tables, and to program all those features from scratch would use an insane amount of time on the web.
- jessedhillon 13y agoAs far as alternatives go, it's trivial to reproduce most of DataTables' functionality with AngularJS by binding an array of objects to a template for a table. Of course DataTables has been available for years, but I have to agree that the API is atrocious. There's no excuse to be using Hungarian Notation in 20xx, but even without the naming conventions the way some of the functions are invoked and arguments are constructed is just bizarre. Parsing HTTP parameters is laborious and error-prone IIRC. (Again IIRC some arguments, such as which column to sort on by default, are the actual integer index into the columns array -- i.e. pass a 1 to sort on the second column. The last time I saw anything like this was when I was looking at Quake3 source, written in C!) However it does the job well once it's all set up and for a long time it was miles ahead of any other option. Only ExtJS and YUI grids are/were better but those require large frameworks and a number of assets to be in place. I would never advise someone to use it today though, I have to say. I used it once for a critical project and in retrospect I would have rolled my own, despite time constraints.
- m_mueller 13y agoThanks, that's way more helpful. In my case I didn't think about using Angular since I wanted the templating to be serverside in general - it's an interesting idea to use it only for the asynchronous parts. I don't get the hate for Hungarian notation and 0 based column index though. I wouldn't use Hungarian myself but I don't complain about it either - for dynamic typed languages it makes enough sense to me, since it conveys the desired type information without too much clutter. How would you specify the column of a html table? IDs don't really make sense since it could be inconsistent or missing - I guess a 1 based index might be better for consistency with CSS, but it's not really something that makes me want to switch framework.
- arethuza 13y agoThe naming convention annoyed me for about 10 minutes then I just got on and used it - at least the notation is documented: http://datatables.net/development/ http://datatables.net/development/
- theallan 13y agoDataTables author here - I completely agree that the API is far from the best, which is why v1.10 will include an entirely new "modern" API (with a shim for the old API to provide full backwards compatibility). The prefix letters aren't random, but they aren't elegant either. When I first wrote DataTables I was working for a company which required the use of Hungarian notation in their coding standards, so I was trained to write that way - I've never changed it because I didn't want to break backwards compatibility. Having said that, v1.10 provides a camelCase layer, which will be what is documented at the API / options with 1.10. Again the Hungarian notation will be supported for full backwards compatibility. v1.10 is available in github (1_10_wip branch) if you want to try it. It is pre-beta, but almost ready to roll as a beta - I just need to write the documentation.
- greenpizza13 13y agoDatatables is a nice, but very old set of tools. There are many more precise solutions out there. Datatables is whole cow when most people just want a piece of steak.
- d0m 13y agoI'm using it in a project presently, it's a very powerful library. The project started simple.. but the table part quickly grow very complex and that plugin never let me down. The best part of the documentation is the examples IMHO. There are also very good plugins[1] to use it on the backend.. [1] https://bitbucket.org/pigletto/django-datatables-view https://bitbucket.org/pigletto/django-datatables-view
- misiti3780 13y agoI use this in a ton of different projects. Besides the fact that it is an awesome library, I love pushing all of the sorting work to the client side (and telling anyone who complains about the speed that it's their browser's fault :) )
- cobookman 13y agoSuch a useful plug-in for CRUD WebApps.
- mithras 13y agoIt's a behemoth, but a very useful one.
- anupshinde 13y agoWhats new about this? Used this in the past - not anymore - there are better alternatives these days.
- jph 13y agoPaid support is excellent. I use DataTables in some client projects, and wanted to speed up my use of it. I paid for support and had the author's full attention the same morning. Works like a charm.
- epoxyhockey 13y agoMake DataTables editable with this addition: https://code.google.com/p/jquery-datatables-editable/ https://code.google.com/p/jquery-datatables-editable/ It is really fantastic for that live spreadsheet feel.
- ndesaulniers 13y agoHell yeah, I used DataTables in my iTunes in the browser clone. [0] But it's not super new, not sure why it's up here. It also isn't the greatest for responsive design. That said, it's still great, and my favorite feature is search. [0] https://github.com/nickdesaulniers/audiostream https://github.com/nickdesaulniers/audiostream
- warpech 13y agoIf you need editable tables, I wrote this http://handsontable.com/ http://handsontable.com/
- theallan 13y agoDataTables author here - I've often wondered what article or software I might write to see if I could get onto the hacker news front page. Apparently the trick is to wake up one morning and be very pleasantly surprised to see existing software already there :-) Very happy to answer any questions if anyone has any!
- m_mueller 13y agoThanks for writing this piece of software! I appreciate all the configurability. One thing that irks me bit, is the way action buttons are handled (using TableTools, ColVis and the like). Ideally I'd like to place and style the buttons the way I want and just have JS handles for activating their functions as well as state change events. Maybe I've missed something, but I couldn't find how to do this from looking at the documentation as well as the ColVis source code. Did I miss something or do you have plans changing this in the future?
- theallan 13y agoPlans to change it in the future. I'm planning on merging the abilities of ColVis (given that it just calls a standard DataTables API method) into TableTools and improving the TableTools API / configuration options. At the moment ColVis is a little bit lagging while waiting for this to be implemented - which will be the first thing on the cards when DataTables 1.10 is released.
- m_mueller 13y agoThanks, that's good to know. Makes me want to come back to DataTables once these changes are in effect.
- johnny_reilly 13y agoHi theallen, I've made a great deal of use of jqGrid which I've found to be an excellent piece of software. I've always been meaning to give DataTables a try as well but haven't yet got round to it. Assuming you're aware of jqGrid how would you compare / contrast it with DataTables?
- iriche 13y agoI wrote a small library in Python for DataTables when I got tired over that there was no easy way of doing backend processing for it. https://github.com/starstable/PonyTable https://github.com/starstable/PonyTable Warning, probably not PEP-8 and can probably be improved in a tons of places.
- shrikant 13y ago1. Keep Excel spreadsheet in a shared network location 2. Set to autogenerate webpage on every save 3. Clean up crufty HTML with jQuery 4. Display using DataTables 5. Proit! This hacky hackerson of a hack was great way to get around having to build a CRUD app and go through IT channels to have something deployed on the network, and still keep things simple enough for extremely entry-level end-users. Thanks for DataTables, Allan!
- b3n 13y agoDoes anyone know how this compares to jTable (http://www.jtable.org/ http://www.jtable.org/)?
- Davertron 13y agoDo you still have to set the column widths explicitly? That was one of the main reasons I had to drop this lib, because we had dynamic data and I didn't want to deal with adding a bunch of JavaScript on top to resize columns on the fly when the data changed.
- vyrotek 13y agoWell this was random. I literally started using DataTables for the first time just today for a new project. I must admit, the Hungarian notation is a bit distracting at first. The documentation could be better as well. In the past I've used dgrid with the DojoToolkit. It's not for everyone, but it was great to work with. http://dojofoundation.org/packages/dgrid/ http://dojofoundation.org/packages/dgrid/ http://demos.dojotoolkit.org/demos/themePreviewer/demo.html http://demos.dojotoolkit.org/demos/themePreviewer/demo.html
- Eyes2design 13y agoUsing table management with my current robust Coffee script Nodejs project. I'm going to have Fun. Mostly I can only classified myself as a home-school ged self-study (Op Dev) but its always fun to read and work with other's code. do you have any idea when you will have 1.10 out in the public? is their a git hub I can look at? .. Food for thought Magento maybe able to run some faster admin tables with this. though, I would think this would be a task in setting up. The Json is their but admin panels setup is another thing in Magento.