I'm trying to add a custom button to sharepoint library using documentation* found on the site.
Seems no matter what I do I can't get this to work, please tell me where I am going wrong.
*Work with buttons on the toolbar of a List or Library — SharePoint forms
I've added the below code to my JS > Current Form.
I am expecting to icon in my list view, but no success.
//ADD CUSTOM BUTTON
fd.spRendered(function() {
//new button
var button = {
text: '',
class: 'btn-secondary',
visible: true,
icon: 'Blocked',
iconType: 0,
location: 1,
click: function() {
alert('Button clicked!');
}
}
fd.control('SPDataTable1').ready().then(function(dt) {
//dt parameter is the same as fd.control('SPDataTable1')
dt.buttons.push(button);
});
});
All other buttons have been hidden using CSS, my custom button is not appearing.