Question

I want my django_tables2 table to be able to add new rows at the top as new data comes in from the server (possibly by polling, or possibly via a push). I don't want to do a server page refresh, just scroll the existing rows down and add the new rows at the top.

I know I can just set up a periodic refresh from the server but that's not what I want to do.

Is this possible? After much searching, I have not found any reference to doing this.

Thanks.

Was it helpful?

Solution

Django-tables2 is a great tool, but it is built around a classical notion of doing everything on the server side. If you find yourself reaching out to band-aiding custom ajaxy solutions on top of it, I would recommend you to look into going with django-eztables instead.

This library effectively gives you out-of-the-box integration with jQuery DataTables, which is a rock-solid framework.

After installing eztables you'll instantly be able to update table data without refreshing the whole page and also keep the user-selected filtering an sorting (and easily do much, much more). I personally use eztables, they are quite modern, but nevertheless well-tested and robust.

OTHER TIPS

Best solution would be, I think, SlickGrid. Just add your data from an ajax request,

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top