简体   繁体   English

widgetvar复合组件VS命名容器

[英]widgetvar composite component VS naming container

I've make a composite component with an overlayPanel inside. 我已经制作了一个内部带有overlayPanel的复合组件。 I put my widgetVar like BalusC suggest: widgetVar="#{cc.id}_MyOverlayPanelWidget" and refer to with PF('#{cc.id}_MyOverlayPanelWidget').hide() . 我把我的widgetVar像BalusC建议的那样: widgetVar="#{cc.id}_MyOverlayPanelWidget"并用PF('#{cc.id}_MyOverlayPanelWidget').hide()

My need is to use my composite component into an p:tabview . 我需要将我的复合组件用于p:tabview It's valid to have same id for my component inside different naming container. 在不同的命名容器中为我的组件使用相同的ID是有效的。 The issue is when I load my 2 tabs, I have same widgetVar for 2 object. 问题是当我加载2个选项卡时,我有2个对象相同的widgetVar。 I won't use cc:clientId cause : isn't valid for widgetVar. 我不会使用cc:clientId原因:对于widgetVar无效。 What do you recommend for this situation? 您对此情况有何建议?

Use cc.clientId and replace all colons with a valid symbol. 使用cc.clientId并将所有冒号替换为有效的符号。 That's what PrimeFaces itself does when autogenerating widgetVars, it replaces colons with underscores. 这是PrimeFaces本身在自动生成widgetVars时所做的工作,它用下划线替换冒号。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM