Display of custom button according to 'recordsTotal' in data
Display of custom button according to 'recordsTotal' in data
Abdullah61
Posts: 2Questions: 1Answers: 0
Sorry if this question has a solution already answered, I searched a lot but couldn't find it.
I am using server side.
In my example scenario I have a button and I want to control whether that button appears according to the 'recordsTotal' from the ajax response. I want to use buttons.available for this, but the DataTables API that this function takes is not working. Is there a solution to this?
This question has an accepted answers - jump to answer
Answers
Looks like the
buttons.buttons.available
runs before the asynchronous Ajax response has returned. That is why you seeundefined
in the console.Use
initComplete
for this. The second parameter isjson
which has the server side processing response. You can get therecordsTotal
value. You can use eitherbutton().add()
orbutton().remove()
to adjust the buttons based on therecordsTotal
value.Kevin
Thank you, a different perspective is always helpful.