Frequent table.ajax.reload()

Frequent table.ajax.reload()

jure@enerco.sijure@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.

Answers

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin

    If you use ajax.reload() the table is cleared and then new data added. So the table's scrolling (assuming you are using scrollX or scrollY - 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

  • jure@enerco.sijure@enerco.si Posts: 3Questions: 1Answers: 0

    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

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin

    I would probably suggest enabling paging and using deferred rendering. That will minimise the CPU hit.

    Allan

  • jure@enerco.sijure@enerco.si Posts: 3Questions: 1Answers: 0

    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

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin

    Deferred rendering: deferRender. Basically the row nodes are only created when the row needs to be displayed. Makes things much faster.

    Allan

This discussion has been closed.