p:panelGrid 究竟如何扩展 h:panelGrid
How exactly does p:panelGrid extends h:panelGrid
我正在使用 Primefaces,我知道 p:panelGrid
扩展了 h:panelGrid
,因为它在 documentation.
中有明确说明
但是我看不出它们之间的确切区别。 p:panelGrid
提供了哪些额外功能?在哪些情况下我应该更喜欢使用 Primefaces 版本而不是 HTML 基本版本?
虽然 p:panelGrid
扩展了 h:panelGrid
,但它实际上缺少 h:panelGrid
包含的许多属性。这最终让我感到困惑。
我不能代表 PrimeFaces 的实际意图(我不是 PrimeFaces 开发者),但根据我目前的观察,我只能得出结论,他们省略了只会在 HTML 透视图(主要是 HTML-不推荐使用的属性——改用 CSS)或者没有其他意义(并且在父组件或子组件中的位置更好)。我只能说这是一件好事。
根据 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 a.o. <h:panelGroup>
). This design decision is most likely done to have more flexibility in the rendered output as shown in the showcase 中的进一步检查。
通常,只有当您真正需要 enhanced/new 功能时,您才应该选择增强组件。这通常只会在您确定您确实需要这样一个功能并发现标准组件中缺少它时才会发生。然后,您通常已经知道要查找的关键字,如果它们尚未实现,您只需开始使用这些关键字探索组件库即可。
我正在使用 Primefaces,我知道 p:panelGrid
扩展了 h:panelGrid
,因为它在 documentation.
但是我看不出它们之间的确切区别。 p:panelGrid
提供了哪些额外功能?在哪些情况下我应该更喜欢使用 Primefaces 版本而不是 HTML 基本版本?
虽然 p:panelGrid
扩展了 h:panelGrid
,但它实际上缺少 h:panelGrid
包含的许多属性。这最终让我感到困惑。
我不能代表 PrimeFaces 的实际意图(我不是 PrimeFaces 开发者),但根据我目前的观察,我只能得出结论,他们省略了只会在 HTML 透视图(主要是 HTML-不推荐使用的属性——改用 CSS)或者没有其他意义(并且在父组件或子组件中的位置更好)。我只能说这是一件好事。
根据 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 a.o. <h:panelGroup>
). This design decision is most likely done to have more flexibility in the rendered output as shown in the showcase 中的进一步检查。
通常,只有当您真正需要 enhanced/new 功能时,您才应该选择增强组件。这通常只会在您确定您确实需要这样一个功能并发现标准组件中缺少它时才会发生。然后,您通常已经知道要查找的关键字,如果它们尚未实现,您只需开始使用这些关键字探索组件库即可。