2017-10-18 216 views
0

我正在使用primefaces的web應用程序。我使用的是數據表,每次將鼠標移動到表格中,滾動條會出現在底部,偶爾會出現在右側。我不想或不需要這個滾動條。 Mouse inside the table and useless scrollbar appears on the bottom如何停止滾動條出現在dataTable中?

<p:dataTable var="o" id="territoryTable" widgetVar="territoryDataTable" value="#{searchTerritory.lazyModel}" lazy="true" dynamic="true" paginator="true" paginatorPosition="bottom" rows="#{configParams['dataTable.row.default']}" styleClass="dataTableMargin" 
 
    rowKey="#{o.id}" selectionMode="single" rowsPerPageTemplate="#{configParams['dataTable.row.values']}"> 
 

 
    <p:ajax event="rowSelect" listener="#{searchTerritory.onRowSelect}" /> 
 
    <p:ajax event="filter" ignoreAutoUpdate="true" /> 
 

 
    <p:column headerText="#{messages['territory.id']}"> 
 
    <h:outputText value="#{o.custom_id}" /> 
 
    </p:column> 
 

 
    <p:column headerText="#{messages['territory.name']}"> 
 
    <h:outputText value="#{o.name}" /> 
 
    </p:column> 
 

 
    <p:column headerText="#{messages['territory.description']}"> 
 
    <h:outputText value="#{o.description}" /> 
 
    </p:column> 
 

 
    <p:column headerText="#{messages['status.active']}"> 
 
    <p:selectBooleanCheckbox disabled="true" value="#{o.activeFlag}" /> 
 
    </p:column> 
 

 
    <p:column headerText="#{messages['territory.coordinator.TerritoryManager']}"> 
 
    <h:outputText value="#{o.territoryManager.name}" /> 
 
    </p:column> 
 

 
    <p:column headerText="#{messages['territory.coordinator.status']}"> 
 
    <h:outputText value="#{o.territoryManager.activeFlag eq true ? 'Active' : 'Inactive'}" /> 
 
    </p:column> 
 
</p:dataTable>

任何人有關於如何去除它的想法?

+0

這不是默認的行爲...最有可能你的自定義CSS弄亂了事情。或者您可能放大了瀏覽器? – Kukeltje

回答

1

我會建議一個純粹的CSS解決方案,你只需隱藏滾動條。溢出的內容將被隱藏。

你需要在你的CSS插入下面的:

.dataTableMargin .ui-datatable-tablewrapper { 
    overflow: hidden; 
} 

其中dataTableMargin是你給出的styleClass和ui-datatable-tablewrapper是圍繞着數據表內容的包裝。 PS:確保您的內容始終位於給定的視圖內。否則太大的內容將被截斷。

+0

我剛剛意識到它發生鉻,當我使用IE瀏覽器,我沒有得到任何問題。 –

+0

@LiamPaquette:PF版?你讀過關於縮放的評論嗎? – Kukeltje