Expand my Community achievements bar.

SOLVED

Delete tab from my customised tabbed component

Avatar

Level 2

Dear All,

 

I have an customised tab component and when i am deleting tab then it is deleting from frontend (my HTML page) but it is not deleting from CRXDE, means in node still it is present.

 

For Example.

I have created 3 tabs (tab1, tab2 and tab3) and in each tab I have 2 links.

Now I am deleting tab3 , then it is not displaying in HTML page , but it is still present in the Node JCR property.

 

How can I remove from backend / node in crxde as well ?

 

Any suggestion or any idea ?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@sunitaBorn It is not possible to delete the selective values like that if you update the fieldName or delete the fields from the frontend.

For that either you can write a script if there are many entries in the system. Based on the query you can get the result and clean the respective content node. OR

While saving the dialog get the overwrite all the value present in the bakcend. Sample code for deleting the properties.

public void update(ModifiableValueMap vm) {
    for (Entry<String, Object> entry : properties.entrySet()) {
      if (entry.getValue() != null) {
        vm.put(entry.getKey(), entry.getValue());
      } else {
        vm.remove(entry.getKey());
      }
    }

Thanks 

View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor

@sunitaBorn It is not possible to delete the selective values like that if you update the fieldName or delete the fields from the frontend.

For that either you can write a script if there are many entries in the system. Based on the query you can get the result and clean the respective content node. OR

While saving the dialog get the overwrite all the value present in the bakcend. Sample code for deleting the properties.

public void update(ModifiableValueMap vm) {
    for (Entry<String, Object> entry : properties.entrySet()) {
      if (entry.getValue() != null) {
        vm.put(entry.getKey(), entry.getValue());
      } else {
        vm.remove(entry.getKey());
      }
    }

Thanks 

Avatar

Community Advisor

Hi @sunitaBorn ,

By deleting the tab you mean cq:dialog tab? or were you deleting the tab from your html UI?

If you delete the tab on your UI, since the authored values are present on the dialog level, you will still be able to see the properties on JCR node. If that's the case, please remove the component from the page and re-author or you can delete the property on your JCR Node (former one is recommended and the later one is advisable only on your local instance but not on higher environments).

If you deleted your cq:dialog tab on dialog's content.xml, please re-author component on the page, that should be able to remove your previously authored values.

Thanks,

Sravan

Avatar

Level 2

Hi @sunitaBorn 

You can delete it manually from crx/de by login in using administrator. It is expected behavior that if you have authored some value and later on the field is removed from the CQ dialog then this needs to be removed manually or via script(which is not necessary until it needs to be done for many pages)

Regards,
Arpit Varshney

Avatar

Community Advisor

Hi @sunitaBorn ,

 

Can you please refer AEM Core component implementation here 

/apps/core/wcm/components/tabs/v1/tabs

 I don't see any issues there - while deleting items node is also getting deleted. Sharing this as it might help to enhance your custom component.

Screen Shot 2022-06-23 at 10.27.58 AM.png

However, In your custom implemented component, if wish to enhance following core component that should solve problem. Or you can also delete those nodes by script but that's least recommended, leaving them as is no harms but eventually should cleanup repo.

Hope that helps!

Regards,

Santosh