Multiple Ajax Data Sources

Multiple Ajax Data Sources

jrussellazjrussellaz Posts: 3Questions: 1Answers: 0

Hello,

I'm looking for advice on the best pratice to populate a datatable with multiple datasources. I'm building a table that lists projects. Separate from the projects list is a task list. Currently, I'm using one Ajax request to load a list of projects and populate the table. Then, in the drawCallback I'm iterating the rows and using the Project ID to do another Ajax request for each row to load the projects tasks. This approach loads the initial table very quickly however it creates a lot of Ajax requests and since some of the data isn't loaded until the drawCallback, sorting and searching doesn't work.

The datasource isn't a database, so I can't do a tradition join to retrieve all the information in one request. Loading all the projects and tasks prior to displaying the table would be slow.

Are there any recommended approaches for handling this situation?

Thanks in advance,
jrussellaz

Answers

  • allanallan Posts: 63,815Questions: 1Answers: 10,517 Site admin

    Best practice would probably be to try and combine all of the data into a single Ajax data feed. Otherwise, an Ajax request for every row sounds like seriously heavy load on the server and a sluggish UI on the client-side.

    Allan

  • audrineaudrine Posts: 4Questions: 1Answers: 1

    Hi jrussellaz,

    I am trying to do exactly what you are doing. I would really appreciate it if you could share the code. Did you manage to make the load the table faster.

    Regards,
    Audrine

This discussion has been closed.