Frequent table.ajax.reload()
Frequent table.ajax.reload()
jure@enerco.si
Posts: 3Questions: 1Answers: 0
I am trying to frequently update a table with approx. 100-150 entries.
How would be the best way to do this in order to refresh the data in 2-3 sec intervals?
I am showing all 100 lines at once. Currently, when the ajax reply is being processed,
the firefox halts the scrolling. This is what I would like to avoid. Any suggestions?
Using Datatables 1.10.5 with Bootstrap.
This discussion has been closed.
Answers
If you use
ajax.reload()
the table is cleared and then new data added. So the table's scrolling (assuming you are usingscrollX
orscrollY
- without a test case, as required in the forum rules it is impossible to say) will always be reset.If you didn't want the scrolling to reset you would need to update the existing data.
Allan
No, I'm talking about web browser's scrolling.
If you scroll through 150 entries and there is a table.ajax.reload() in between, the browser will block scrolling for a while. If you're at 500 records, the browser (FF) will
almost stop responding. I guess reload is pretty costly in terms of cpu.
Now I changed server side behaviour to return only updated rows and I update them manually through table.rows().each()...
Would you think this is a right way to go for a frequent update?
Rgds,
Jure
I would probably suggest enabling paging and using deferred rendering. That will minimise the CPU hit.
Allan
Ok, so I did paging and we're manually updating only parts
of the table through table.row().data()... This seems good now.
What is the exact idea behind "deferred loading"?
Really nice Thank you,
Jure
Deferred rendering:
deferRender
. Basically the row nodes are only created when the row needs to be displayed. Makes things much faster.Allan