Display of custom button according to 'recordsTotal' in data
Display of custom button according to 'recordsTotal' in data
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
This discussion has been closed.
Answers
Looks like the
buttons.buttons.availableruns before the asynchronous Ajax response has returned. That is why you seeundefinedin the console.Use
initCompletefor this. The second parameter isjsonwhich has the server side processing response. You can get therecordsTotalvalue. You can use eitherbutton().add()orbutton().remove()to adjust the buttons based on therecordsTotalvalue.Kevin
Thank you, a different perspective is always helpful.