Expand my Community achievements bar.

Applications for the 2024-2025 Adobe Experience Manager Champion Program are open!
SOLVED

remove dialog tab

Avatar

Level 4

Hi,

I need to make a check during the loadcontent of a diloag to remove a tab

Anyone can explain me which is the right code to remove the tab nav1? Thanks

<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" jcr:primaryType="cq:Dialog" xtype="dialog"> <listeners jcr:primaryType="nt:unstructured" loadcontent="function(dialog) { var d = dialog.findParentByType('tabpanel'); if (...){ //d.hideTabStripItem('nav1'); //this.ownerCt.findById('nav1').remove(); }" /> <items jcr:primaryType="cq:WidgetCollection"> <tabs jcr:primaryType="cq:TabPanel"> <items jcr:primaryType="cq:WidgetCollection"> <tab jcr:primaryType="cq:Widget" title="Profile Property" xtype="panel"> <items jcr:primaryType="cq:WidgetCollection"> <nav1 jcr:primaryType="cq:Widget" title="nav1" itemId="nav1" cqinclude... /> <nav2 jcr:primaryType="cq:Widget" title="nav2" itemId="nav2" cqinclude... /> </items> </tab> </items> </tabs> </items> </jcr:root>
1 Accepted Solution

Avatar

Correct answer by
Administrator

Hi

Please have a look at these reference articles:-

Link:- http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manage...

// How to show or hide tab in dialog in cq

Step 1: give the tab to show/hide an ID

  1. <tab2 jcr:primaryType="cq:Panel" title="tab2" itemId="tab2">
  2. ...
  3. </tab2>

Step 2: add a listener to the selection which you want to handle:

If the selection is 'no' the tab will be disabled, otherwise enabled.

 
  1. <select
  2. jcr:primaryType="cq:Widget"
  3. fieldLabel="ShowTab"
  4. name="./show"
  5. type="radio"
  6. value="yes"
  7. xtype="selection">
  8. <options jcr:primaryType="cq:WidgetCollection">
  9. <option1 jcr:primaryType="nt:unstructured" text="Yes" value="yes"/>
  10. <option2 jcr:primaryType="nt:unstructured" text="No" value="no"/>
  11. </options>
  12. <listeners jcr:primaryType="nt:unstructured"
  13. selectionchanged="function( field,value, isChecked ){
  14. if (field !=null){
  15. var d = field.findParentByType('tabpanel');
  16. if (value == 'no'){
  17. d.hideTabStripItem('tab2');
  18. }else{
  19. d.unhideTabStripItem('tab2');
  20. }
  21. }
  22. }"/>
  23. </select>

 

 

Link:- https://forums.adobe.com/thread/1096389?tstart=0

//Disabling a tab in a dialog dynamically

 

Link:- http://stackoverflow.com/questions/8165800/cq5-hiding-a-tab-within-a-component-dialog-depending-on-u...

//ACL approach is the way to go

 

I hope this might will help you.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

View solution in original post

2 Replies

Avatar

Level 10

You should use hideTabStripItem

Here is one example from documentation https://docs.adobe.com/docs/en/cq/5-5/developing/widgets.html#Dynamic Dialogs

Avatar

Correct answer by
Administrator

Hi

Please have a look at these reference articles:-

Link:- http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manage...

// How to show or hide tab in dialog in cq

Step 1: give the tab to show/hide an ID

  1. <tab2 jcr:primaryType="cq:Panel" title="tab2" itemId="tab2">
  2. ...
  3. </tab2>

Step 2: add a listener to the selection which you want to handle:

If the selection is 'no' the tab will be disabled, otherwise enabled.

 
  1. <select
  2. jcr:primaryType="cq:Widget"
  3. fieldLabel="ShowTab"
  4. name="./show"
  5. type="radio"
  6. value="yes"
  7. xtype="selection">
  8. <options jcr:primaryType="cq:WidgetCollection">
  9. <option1 jcr:primaryType="nt:unstructured" text="Yes" value="yes"/>
  10. <option2 jcr:primaryType="nt:unstructured" text="No" value="no"/>
  11. </options>
  12. <listeners jcr:primaryType="nt:unstructured"
  13. selectionchanged="function( field,value, isChecked ){
  14. if (field !=null){
  15. var d = field.findParentByType('tabpanel');
  16. if (value == 'no'){
  17. d.hideTabStripItem('tab2');
  18. }else{
  19. d.unhideTabStripItem('tab2');
  20. }
  21. }
  22. }"/>
  23. </select>

 

 

Link:- https://forums.adobe.com/thread/1096389?tstart=0

//Disabling a tab in a dialog dynamically

 

Link:- http://stackoverflow.com/questions/8165800/cq5-hiding-a-tab-within-a-component-dialog-depending-on-u...

//ACL approach is the way to go

 

I hope this might will help you.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni