Streamtable.js vs. Datatables

Streamtable.js vs. Datatables

tphamtpham Posts: 2Questions: 0Answers: 0
edited April 2013 in General
I've been a fan of datatables and used it for numerous projects. Recently, I stumbled upon this StreamTable.js (http://blog.joshsoftware.com/2013/04/23/streamtable-js-the-next-generation-search-filter/), and it looks fairly interesting. Has anyone have any thoughts about it? Thanks.

Replies

  • allanallan Posts: 63,518Questions: 1Answers: 10,473 Site admin
    StreamTable looks very interesting. The same effect can be created in DataTables by using fnAddData - simply poll the server for your new data (which is what StreamTable is doing) and add it to the table.

    For me, real streaming of data could be done through WebSockets - again with the server sending new data, and using the DataTables API to update the table. That could include updates to rows as well as new rows.

    Allan
  • GautamRegeGautamRege Posts: 1Questions: 0Answers: 0
    edited April 2013
    Good to see this discussion starting here - getting some competition for dataTable is good for both :)

    StreamTable was born because of 2 primary needs:
    + We found the configuration for DataTable quite complex.
    + We also needed a seamless streaming approach. While fnAddData is supposed to be client-side stuff, to make it work with server-side poll, the user has to prod around bit for it.

    The good, constructive twitter tussle is here: https://twitter.com/gautamrege/status/326950675579822080

    Apart from this, we have simplified a few things:
    + StreamTable is currently ~400 lines as compared to ~12000 lines of DataTable.
    + We use callbacks for managing / massaging the data instead of configuration like aoColumns
    + We have steered clear of fnRender for rendering each column and instead rely on view callback which can be used with simple clean templates like mustache. So, there is more control.
    + StreamTable allows us to work with even non-tabular formats - i.e. it need not just be a table, the data representation can change and can be controlled for custom views.

    Back to the streaming bit:
    Adding websocket support is definitely a good idea but it may be an overkill if we have a result sub-set (that may require a pub/sub kinda model). Its also a heavy price to pay because it would need some server-side component to work with -- are you planning this for DT?
  • MikeSMikeS Posts: 113Questions: 1Answers: 0
    IMO, Streamtable seems to be good at retrieving the data - quick. The not so good side is that it doesn't seem to have the "bells and whistles" of dataTables. Where's the column/multi-column sorting, row grouping, fixed headers, fixed columns, mover columns, detail rows, footer summary, and on and on.. ? If Streamtable can do all or some of that, I don't see it in their example.

    If only the two could merge we would have a dataStreamTable :)
  • allanallan Posts: 63,518Questions: 1Answers: 10,473 Site admin
    Competition is great!

    I should first say that while I'm proud of DataTables, I know its limits and it is never going to be a single solution that works for everyone. No library possibly can be, and there will always be areas which can be improved. Case in point is my work on DataTables 1.10 at the moment which completely revamps the API and drops the hungarian notation (backwards compatible changes!), making initialisation cleaner and the data easier to work with.

    A library which can handle streaming data for tables is fantastic. I think ultimately, any table / grid component which can handle adding, deleting and editing rows can deal with truly streamed data (the WebSocket that I was hinting at). Equally any component which can add data using an API can handle the addition of data retrieved by polling (a small example of doing this with DataTables' fnAddData method: http://live.datatables.net/atoyil/edit ).

    Doing fully streamed data (WebSocket) is something that I think should exist outside of the table library, whereby it can do the data retrieval, and tell the table to add, edit or delete rows (realtime stock information is a good example and I've seen DataTables used for this kind of thing). Its also very highly server dependent (or at least communications channel dependent) so its not something that I'm planning on including as part of DataTables core. DataTables is going to stay focused on the data in the table only.

    I like the use of callbacks as they've been used in StreamTable. Personally I find mData very easy to use in DataTables when working with json objects as the data source), but I see the attraction of manipulating the data wholesale. This actually can be done with DataTables at the moment, but with an event ( `xhr` ) rather than a callback, since it is passed the data which can then be manipulated before being drawn.

    I also really like the use of mustache - while I'm not going to add any dependencies to DataTables (other than jQuery), a template plug-in is something I've been thinking of (it would automatically built the column definitions for you), and that's a really attractive option. Its great to see templates being used so powerfully here.

    Finally size - DataTables is ~70k minified, ~22K gzipped, (a very large amount of the 12'000 lines are doc comments). I'm working really hard to ensure that DataTables doesn't go far beyond that point with the new features going in for 1.10. Difficult with the number of features included, but it should be possible. The goal ( http://datatables.net/development/roadmap ) is to make DataTables fully modular with v1.12, when you'll be able to pick and choose the components you want. It will never be 400 lines, but it should be able to go quite small depending on the modules selected.

    Great work with StreamTable - I look forward to seeing it develop :-). And thanks also for your feedback on how you found DataTables and why it wasn't a good fit for your use case.

    Regards,
    Allan
  • SorensenSorensen Posts: 3Questions: 0Answers: 0
    [quote]allan said: Case in point is my work on DataTables 1.10 at the moment which completely revamps the API and drops the hungarian notation[/quote]
    This is the best thing I've heard all day!! :D
  • tphamtpham Posts: 2Questions: 0Answers: 0
    Thank you so much for your feedback. You guys are great!
This discussion has been closed.