Datatable loops over data three times
Datatable loops over data three times
jrbulnes
Posts: 5Questions: 0Answers: 0
My datatable was too slow. Inside a have a function to call for more data to do some checking. I've noticed it that the function was call three times for each row. I commented out the call to the function add an alert and noticed that any way the table goes over the data three times before it display it.
This discussion has been closed.
Replies
What function? If you could post a link to a test case showing the issue as required in the forum rules that would be good.
Thanks,
Allan
It is a regular function to get more data. Like I said even if I commented out the data loops three times. Here is how I call my function. Since I am using server data I don't know how to give you a link to a test case, I just answerered a couple of questions from other people an neither of them had links. Thank you.
Here is how I comment out the call to my function and display an alert:
I see - it is the
columns.render
function that you are concerned about? I didn't know that you were using that option.Yes, it will be called multiple times - is it expected and the desired behaviour. Every time DataTables needs to get data for that cell it will call that function. This is how orthogonal data is handled in DataTables.
If your
getReservationAttendee
function is slow, then it might be worth caching the results to speed things up.Allan
Thank you for the explanation Allan, now I understand why it loops three times when using columns.render. I will ask for a new stored procedure to the DBA to avoid using render.