List Control > How to remove items in New+ button dropdown

Hi Plumsail,

I need to hide the buttons on the New+ button dropdown (see below image).
I need to only show "Follow Up" and hide everything else.

All of these are showing because they are "Content Types" for the List.

I worked out a way to do this previously, however with the latest update of Plumsail, my code is no longer working.

How do I get a handle on the drop down object, specifically for this New+ button?

(Image below)

Thanks - Adam J

Hello @adamj,

Welcome to plumsail Community!

You can use this code to display only specific content types in the New button menu:

fd.spRendered(function() {
    fd.control('SPDataTable1').ready().then(function(dt) {
        var button = dt.buttons[0];
        var prop = button.componentProps.availableTemplates;

        var newProp = []
        prop.forEach(function(template){
            if(template.title == 'Content Type Name'){
                newProp.push(template)
            }
        })
        button.componentProps.availableTemplates = newProp

        if(newProp.length == 1){
            $(fd.control('SPDataTable1').$el).find('.btn.dropdown-toggle').hide()
        }
    });
});