简体   繁体   English

p:panelGrid到底如何扩展h:panelGrid

[英]How exactly does p:panelGrid extends h:panelGrid

I'm using Primefaces and I know that p:panelGrid extends h:panelGrid as it's clearly stated in the documentation . 我正在使用Primefaces,并且我知道p:panelGrid扩展了h:panelGrid正如文档中明确指出的那样。

However I can't see the exact difference between them. 但是我看不到它们之间的确切区别。 What extra functionalities does p:panelGrid provide? p:panelGrid提供什么额外的功能? In which cases should I prefer using the Primefaces version over the HTML Basic one? 在哪种情况下,相对于HTML Basic,我更喜欢使用Primefaces版本?

Although p:panelGrid extends h:panelGrid , it actually lacks many of the attributes that h:panelGrid contains. 尽管p:panelGrid扩展了h:panelGrid ,但实际上它缺少h:panelGrid包含的许多属性。 Which ultimately got me confused. 最终使我感到困惑。

I can't speak for PrimeFaces' actual intention (I'm no PrimeFaces developer), but based on my observations so far, I can only conclude that they omitted attributes which only invite bad practices in HTML perspective (mainly HTML-deprecated attributes — use CSS instead) or makes no sense otherwise (and are better at its place in a parent or child component). 我无法说出PrimeFaces的实际意图(我不是PrimeFaces开发人员),但是根据到目前为止的观察,我只能得出结论,他们忽略了只会在HTML透视图中引入不良做法的属性(主要是不推荐使用HTML的属性-请改用CSS),否则就没有任何意义(并且在父级或子级组件中更好)。 I can only say that it's a Good Thing. 我只能说这是一件好事。

Upon further inspection in the source code I can also confirm that it doesn't technically extend from <h:panelGrid> ( HtmlPanelGrid class), but from the UIPanel superclass (which is also used by ao <h:panelGroup> ). 在对源代码进行进一步检查之后,我还可以确认它在技术上不是从<h:panelGrid>HtmlPanelGrid类)扩展,而是从UIPanel超类(也由ao <h:panelGroup>UIPanel This design decision is most likely done to have more flexibility in the rendered output as shown in the showcase . 这种设计决策是最有可能做的更灵活的渲染输出,如图中的展示

Generally, you should only prefer an enhanced component whenever you start to actually need the enhanced/new feature. 通常,仅当您开始真正需要增强的/新功能时,才应该选择增强的组件。 This usually only happens once you figure out you actually need such one feature and discover that it is missing in the standard component. 通常只有在您确定确实需要这种功能并发现标准组件中缺少该功能后,才会发生这种情况。 You'd then usually already know the keywords you're looking for and simply start exploring the component libraries using those keywords if they haven't already implemented it. 这样,您通常通常已经知道了要查找的关键字,并且只要尚未实现这些关键字,就可以开始使用这些关键字来探索组件库。

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

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