Answers for "Plumsail add a button to the left side of the toolbar, which will be hidden until an item is selected"

0

Plumsail add a button to the left side of the toolbar, which will be hidden until an item is selected

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;
            }
        });
    });

});
Posted by: Guest on May-03-2022

Code answers related to "Plumsail add a button to the left side of the toolbar, which will be hidden until an item is selected"

Code answers related to "Javascript"

Browse Popular Code Answers by Language