fd.spRendered(function() {
//new button
var button = {
text: 'Get info',
class: 'btn-primary',
visible: false,
icon: 'Info',
iconType: 0,
click: function() {
var items = fd.control('SPDataTable1').selectedItems;
var ids = 'Selected item IDs: ';
items.forEach(function(item){
ids += item.ID + '; ';
});
alert(ids);
}
}
fd.control('SPDataTable1').ready(function(dt) {
//dt parameter is the same as fd.control('SPDataTable1')
dt.buttons.push(button);
dt.$watch('selectedItems', function(items) {
if(items.length > 0){
button.visible = true;
}
else{
button.visible = false;
}
});
});
});