Buttons Extension Not Initializing in Angular using Custom datatable Setting configuration

Buttons Extension Not Initializing in Angular using Custom datatable Setting configuration

byoungmanbyoungman Posts: 14Questions: 2Answers: 0

Good Morning,

I am new to datatables.net and the Buttons extension in particular. I was handed a Angular component that is using datatable.net for table data display and operations. One of the features that the business has asked for it the ability to hide / show columns at will and it looks like the Buttons extension using the 'colvis' button is exactly what I want.

The problem is I'm not having any luck to get the button initialized much less displaying with my table. When the original architect designed this component he used a custom Settings configuration for the table. I've read that if this is the case then you need to instantiate your buttons collection in the Settings module but I'm not having any luck because what I'm running into is when I start to enter the buttons collection property I get an error telling me that 'buttons' is not part of the Settings property collection.

So I tried creating a public variable
public buttons: any = [];

Then in the Settings initialization doing this but I'm still not able to access the buttons collection for the calling component
public defaultDTOptions:DataTables.Settings = {
pageLength:10,
lengthMenu: [
[5,10,100, 250, 500, 1000,-1],
[5,10,100, 250, 500, '1000','All'],
],
initComplete: function (this:any) {
buttons: [ 'colvis' ];

Any and all help is greatly appreciated
Bill

Answers

  • kthorngrenkthorngren Posts: 21,117Questions: 26Answers: 4,916

    I'm guessing you are using Angular Datatables which incorporates Datatables from this site but puts its own wrapper on configurations, etc. There is no documentation nor discussion experts on this forum for Datatables within Angular as the solution is developed by a third party. Assuming you are using what I linked to the Buttons docs are here.

    get an error telling me that 'buttons' is not part of the Settings property collection.

    I would perform a google search with the exact error you are getting. Hopefully you can find something useful.

    Kevin

  • byoungmanbyoungman Posts: 14Questions: 2Answers: 0

    Thank you Kevin and that is exactly what I'm doing and I'll look at the link that you provided me.

    Thanks again

Sign In or Register to comment.