2015-11-03 40 views
0

我想使用對話框架在彈出窗口中顯示數據表。 我的代碼是基於在這裏發表的例子:http://www.primefaces.org/showcase/ui/df/data.xhtmlPrimefaces - 對話框內容不適合彈出面板

我使用這段代碼在我backbean以顯示彈出:

public void chooseImage() { 
     String page = "ImageChooser"; 

     Map<String, Object> properties = new HashMap<String, Object>(); 
     properties.put("modal", true); 
     properties.put("resizable", true); 
     properties.put("draggable", true); 
     properties.put("width", 400); 
     properties.put("height", 400); 

     RequestContext.getCurrentInstance().openDialog(page, properties, null); 
} 

這是我ImagerChooser.xhtml頁面的一部分:

<h:body> 
     <h:form> 

       <p:dataTable var="img" value="#{imageManagerController.imageList}" rows="5" layout="grid" paginator="true" 
        paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" 
        rowsPerPageTemplate="5,10" > 

        <p:column field="#{img.name}"> 
          <h:outputText value="#{img.name}" /> 
        </p:column> 
       </p:dataTable> 
     </h:form> 
    </h:body> 
</code> 

我的問題是,呈現的數據表總是更寬我的對話框(640px)。然後,我需要使用滾動條。我怎樣才能使這個數據可調整大小(取決於對話框的大小)?有沒有自動適應功能?

在此先感謝!

回答

0

我在打開對話框之前在我的backbean中添加了這些屬性,找到了解決方案。

properties.put("contentWidth", 650); 
properties.put("contentheight", 660); 

我希望它能幫助