Not sure how to properly use server-side processing with python back-end code

Not sure how to properly use server-side processing with python back-end code

BenkaiDebussyBenkaiDebussy Posts: 5Questions: 2Answers: 0

Example page link: http://gn2-zach.genenetwork.org/gsearch?type=gene&terms=shh
Python code: https://github.com/genenetwork/genenetwork2/blob/development/wqflask/wqflask/update_search_results.py
Debug: http://debug.datatables.net/iracaq

I've been trying to use DataTables' server-side processing feature in order to prevent overly long page load-times (usually it might take anywhere from 15 seconds to over a minute to complete the SQL query and related python). I've currently gotten to the point where the results will load into the page, but trying to sort the columns seems to send another AJAX call and ends up returning everything in the same order. Is there a way to avoid this and just sort what was initially loaded into the table? Do I need to write some sort of custom sorting functions into my python code? I hope not, since the python code has a bunch of overhead that takes longer than the query itself.

Ideally I would like to do something where the page will display the first X rows immediately upon loading and load the rest when scrolling (using the Scroller extension I guess), but it seems like that wouldn't allow for filtering across all results, which is unfortunately necessary. Maybe I could use Scroller but also have filtering return all rows, but I'm not sure how to do that.

(I probably have a bunch of random unnecessary extensions and stuff imported in my html, but that's because I disabled them all while trying to get this server-side stuff working.)

Thanks!
Zach

This discussion has been closed.