Buttons how to delete a container instance.
Buttons how to delete a container instance.
Hello Community. I am dynamically creating button instances. to load into a dialog box to allow for manipulation of some features. I am to create the instances and append it to the element as I wish. Im also able to delete the buttons that reside inside the container but I'm unable to delete the container itself.
new $.fn.dataTable.Buttons( dt, {
buttons: [
{
text: 'Button 2',
className: 'lateralPanel',
action: function ( e, dt, node, conf ) {
dt.buttons(dt.buttons().containers().length-1, null ).destroy();
myLateral.lateral('close');
}
}
]
} );
dt.buttons(dt.buttons().containers().length-1,null).container().appendTo('#testlat');
This remove the buttons from the container but the newly created container is still there just empty with no buttons.
So the question is how to I empty .containers() of my newly created instance. So i don't continue to fill it with empty instances of buttons.
This question has an accepted answers - jump to answer
Answers
so after the destroy, remove the container html using jquery
Example. I have 5 Containers in this example. Id like to remove the 5th instance from this object. using splice and remove does not remove it from the referenced object. but does remove any buttons in it.
http://jsbin.com/miladah/edit?html,css,js,output removes each button when it is clicked then removes the container if there are no buttons left. Is this what you are trying to do?