AEM5.6 | Select all implementation for dialog
<p>I am trying to implement Select-all checkbox in Component dialog. 
On selecting/checking select-all checkbox, all other check-boxes should be checked &amp; on deselecting/unchecking select-all checkbox, all other check-boxes should be unchecked.</p>

<p><a href="https://i.stack.imgur.com/oQyZa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oQyZa.png" alt="Dialog"></a></p>

<p>The listener code I wrote is</p>

<pre><code>function()
{   
    var type = this.getValue();
    var flag = true;


    if(type==''){
        flag = false;
    }
    if(!flag){
        this.findParentByType('dialog').getField('./pricingVividBlack').defaultValue = false;
    }
    else{
        this.findParentByType('dialog').getField('./pricingVividBlack').defaultValue = true;
    }

}
</code></pre>

<p>Please help me rectify my code to achieve the functionality.</p>