写入JCR的AEM DefaultValue [英] AEM DefaultValue written to JCR

查看:77
本文介绍了写入JCR的AEM DefaultValue的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到,当我为下拉菜单设置defaultValue时,虽然在我第一次将组件添加到页面时在下拉列表中正确选择了它,但是在编辑组件并保存之前,它不会将defaultValue写入相应的JCR中它。即使我只是打开相应的对话框并单击OK,现在我的组件也可以按预期工作,因为这些值已添加到JCR中。

I noticed that when I set my defaultValue for a dropdown, altho it is correctly selected in the drop down when I first add my component to the page it does not write the defaultValue to the corresponding JCR until I edit the component and save it. Even if I just open the corresponding dialog and click OK now my component works as expected because the values have been added to the JCR.

我确定这里缺少一个重要的部分,有谁知道如何将组件正确呈现所需的defaultValues添加到

I am sure there is an important piece that I am missing here, does anyone knows how defaultValues that are required in order for the component to render properly can be added to the JCR when they are first added to the page?

推荐答案

就像Shwan所说的那样,它就是JCR。默认值或空白文本仅用于对话框。在创建对话框之前,它们不会保留。必须通过其他方法设置属性。 CQ已经提供了此功能,您无需任何自定义代码即可完成此操作。

Like Shwan say's that's the way it works. The default values or empty texts are only for the dialog. They aren't persisted until the dialog is authored. The properties have to be set by a different method. CQ already ships with this feature and you can do it without any custom code.

在您的组件下,创建一个名为cq:template [nt:unstructured]的节点。如果所有数据都存储在组件节点本身上,则将默认值作为属性添加到cq:template节点,其名称与对话框中的名称相同。如果数据存储在子节点中,请在cq:template节点下添加一个类似的节点。

Under your component , create a node called cq:template[nt:unstructured] . If all the data is stored on the component node itself , add the default values as properties to cq:template node with name same as the ones in your dialog. In case the data is stored in a child node add a similar node under cq:template node.

来源: http://blogs.adobe.com/experiencedelivers/experience-management/defaults-in-your-component/

这篇关于写入JCR的AEM DefaultValue的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆