I cannot change class button usin className
For example if I assing the class "btn-primary" this class is added but the "btn-default" class is not removed from the button so the new is never active.
Someone know how to do that ?
By using the className parameter when defining the button, it should add the button class btn-primary (it won't hurt to have btn-default there as well) - I do this as well. There should be no need for the addClass() removeClass() methods.
Also, I think the reason your code does not work is because you are defining the class applied to the button and then trying to replace it at the same time the dataTable is being rendered (and creating that class).
Answers
Could you show me the code you are using or link to a page showing the issue please?
Allan
The problem is when I use className adding for example "btn-primary" it leaves btn-default so btn-primary is never active.
I solve it creating a button with
{
text: 'Activar',
className: 'btnLegajo',
.....
}
Then doing
$(".btnLegajo").removeClass( "btn-default" ).addClass( "btn-primary");
By using the
className
parameter when defining the button, it should add the button classbtn-primary
(it won't hurt to havebtn-default
there as well) - I do this as well. There should be no need for theaddClass() removeClass()
methods.Also, I think the reason your code does not work is because you are defining the class applied to the button and then trying to replace it at the same time the dataTable is being rendered (and creating that class).