Live Data/Bandwidth column in datatable ?

Live Data/Bandwidth column in datatable ?

arsalansiddiquiarsalansiddiqui Posts: 128Questions: 15Answers: 0

Hi all,
I have given a task to show live data of our network devices, i'm using php as backend with mysql as database.

The thing i want is i have to load few columns (device_name, ip, device_type) which i get through database which is easy task but i have to keep two columns empty then after full table load i have to show live stats download/upload of that particular network device through api.

I have worked with api and i cant get data from network device, but the challenge is how do i show data in blank row/column and auto update only those two colukmns/rows

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,337Questions: 26Answers: 4,954
    edited March 2020

    Here are a couple of approaches you can look at.

    1. Update your DB with the stats then use ajax.reload() to refresh the table from the DB.
    2. Fetch your data from the API then use either row().data() or cell().data() to update the table. You can use something like rows().every() to loop through all the rows.

    Kevin

  • arsalansiddiquiarsalansiddiqui Posts: 128Questions: 15Answers: 0

    1) I can not save stats in db every second then reload table every second, there are thousands of network devices.

    2) I read documentation about this, but cant find a database related demo to clear my doubts

    There is a similar table what i want, the table not refreshes fully instead only two columns are updating. what i want but it is closed source and also dont made with datatable.

  • kthorngrenkthorngren Posts: 21,337Questions: 26Answers: 4,954
    Answer ✓

    Here is an example of the second option:
    http://live.datatables.net/majicice/1/edit

    It fetches data via a simulated API every 5 seconds and updates the table. In addition to the above links you will want to read up on columns.defaultContent.

    Hope this helps you get started. Your specific requirements may require a different solution than provided.

    Kevin

  • arsalansiddiquiarsalansiddiqui Posts: 128Questions: 15Answers: 0

    Hope this works for me, thank you for your time.

This discussion has been closed.