css - 固定按钮在 JSF 页面对话框中的位置

标签 css jsf primefaces dialog

我正在使用 PrimeFaces 对话框。我那里只有几个元素。一个数据表和 2 个按钮(确定和取消)。 但是按钮显示在底部,只有当我向下滚动整个表格时才可见。我希望它们始终显示在底部,无论我是在第一行还是最后一行。 我搜索了很多但没有找到任何有用的东西。 这是我的代码片段:

<f:facet name="{SelectPrijemca}">
                            <div class="Fs14 Absolute" style="right: 11px; top: 4px">
                                <p:outputLabel value="#{MAService.selectedPrijemca.nazO}" style="color:white"/>
                                <p:spacer width="7px"/>
                                <p:commandButton value="Príjemca" id="selectPrijemcaButton" icon="fa fa-user" rendered="#{MAService.managerAccess}"
                                                 onclick="PF('PrijemcaDialogWidget').show();" style="margin-top:2px">
                                </p:commandButton>
                            </div>
                            <p:dialog id="PrijemcaDialog" header="Vybrať príjemcu" widgetVar="PrijemcaDialogWidget" showEffect="fade" hideEffect="fade" height="600" width="1300" position="center" modal="false" resizable="false" >
                                <h:form id="prijemcaForm">
                                        <p:dataTable 
                                            id="prijemcaTable" 
                                            scrollable="false"
                                            var="prijemca"
                                            widgetVar="prijemcaTableWidget" 
                                            value="#{MAService.prijemcoviaList}"
                                            selectionMode="single" 
                                            filteredValue="#{MAService.filteredPrijemcovia}"
                                            emptyMessage="#{messages.localizeEShop('webclient$datatable.tableEmpty')}"
                                            selection="#{MAService.selectedPrijemca}"
                                            rowKey="#{prijemca.id}" >

                                            <p:column width="50"
                                                filterBy="#{prijemca.nazO}" filterMatchMode="contains"
                                                filterStyleClass="narrowEdit"
                                                headerText="#{messages.localizeEShop('webclient$subfiles.lo.LOObjWeb.cols.PrijNaz')}"
                                                sortBy="#{prijemca.nazO}" styleClass="TexAlLeft"
                                                style="white-space: nowrap !important;>
                                                <h:outputText value="#{prijemca.nazO}" styleClass="TexAlLeft" style="color: gray"/>
                                            </p:column>
                                            <p:column width="5"
                                                filterBy="#{prijemca.ici}" filterMatchMode="contains"
                                                filterStyleClass="narrowEdit"
                                                headerText="#{messages.localizeEShop('webclient$subfiles.lo.LOObjWeb.cols.PrijIci')}"
                                                sortBy="#{prijemca.ici}" styleClass="TexAlLeft"
                                                style="white-space: nowrap !important;>
                                                <h:outputText value="#{prijemca.ici}" styleClass="TexAlLeft" style="color: gray"/>
                                            </p:column>
                                        </p:dataTable>
                                    <p:panelGrid columns="2">
                                        <p:commandButton value="OK" icon="fa fa-check" process="prijemcaForm" actionListener="#{MAService.changePrijemca()}" update="contentForm"/>
                                        <p:commandButton value="Zrušiť" icon="fa fa-times" onclick="PF('PrijemcaDialogWidget').hide()" style="background-color:red"/>
                                    </p:panelGrid>
                                </h:form>
                            </p:dialog> 

                        </f:facet>    

请注意,我无法使 dataTable 可滚动,因为我在另一个 dataTable 的 paginatorTemplate 中使用了这个方面,它以某种方式使该表所在的所有页面都可滚动。

当我将 panelGrid 包装在按钮所在的位置时,我找到了一个部分解决方案:

<div style="position: fixed; width: 65%; top: 70%; left: 16%></div>     

但这并不能修复对话框中的按钮,而是修复整个页面上的按钮。因此,当有办法使对话框不可移动(可拖动)时,我可以采用这种方式。

最佳答案

尝试将您的数据表放入 outputPanel 并设置样式

<p:outputPanel id="opScrl" style="height:560px;overflow:auto">
  <p:dataTable ...>
  </p:dataTable>
</p:outputPanel>

关于css - 固定按钮在 JSF 页面对话框中的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55967687/

相关文章:

html - 图像悬停将无法使用 CSS 背景

javascript - jQuery 中的汉堡菜单

java - 多次重复使用同一页面

jsf - 当选择父列表中的标记项目时重置子 p :selectOneMenus inside a p:dataTable to empty,

java - p :graphicImage streamContent nullpointer

jsf-2 - 我可以在 primefaces 自动完成组件中使用 omnifaces 通用转换器吗?

html - 如何让 float div 直接中断到视口(viewport)的左侧?

html - 如何在水平行中的 Font Awesome 图标之间添加空间

java - 使用 Apache POI 在 Java 中导出到 Excel

java - f :ajax does not render target components in jsf app