Show or hide buttons depending on child item selected in Library/List

I've used the following code successfully to put general conditions on the number of selected items in a list/library control e.g:

dt.$watch('selectedItems', function(items) {
pdfButton.visible = items && items.length >= 1 ;

What I want to be able to do is control the visibility depending on a field in each item (Content Type) -
Is it possible to do this using the $watch function - something like:

dt.$watch('selectedItems', function(items) {
if (item.ContentType === 'Document' )
item.pdfButton.visible = true;

Is this possible?


Hello @abolam,

Could you please share the complete code that is related to List or Library control.

Thank you!

Hi @mnikitina,

Silly question, for some reason when I first tried the above code it did not work, but must have been something else wrong in the code.

When I was able to debug the other problems, this started working fine. Thanks, Andy

1 Like