【问题标题】:primefaces dialog onchange to load datatableprimefaces 对话框 onchange 以加载数据表
【发布时间】:2013-08-02 06:47:06
【问题描述】:

我正在使用 jsf、primefaces 和 jpa 开发一个应用程序。我面临的一个问题是我在对话框窗口中使用单选按钮和数据表。我的条件是选择单选按钮,它从操作中调用一个方法并检索数据列表,但我需要加载数据表中的值。但它没有加载数据表中的值

这是我的 xhtml 代码

<p:dialog header="RxnNo" widgetVar="dlg3" height="500" width="800">
     <p:selectOneRadio id="series" value="#{curation.series}">  
          <f:selectItem itemLabel="SGML" itemValue="1" />  
          <f:selectItem itemLabel="9000" itemValue="2" />  
          <f:selectItem itemLabel="8500" itemValue="3" />  
          <p:ajax listener="#{curation.getSeries9000}" update="seriesDataTable" />
      </p:selectOneRadio>
      <p:dataTable id="seriesDataTable" var="series" value="#{homePage.reactionsList}" widgetVar="seriesTable" scrollRows="20" scrollable="true" rowIndexVar="rowIndex">
             <p:column headerText="Id" filterBy="#{rowIndex+1}">                                    
                    <h:outputText value="#{rowIndex+1}" />
          </p:column>
       </p:dataTable> 
  </p:dialog>

这是我的java代码

public void getSeries9000() throws Exception {
        try {
            if (series.equals("2")) {
                series9000List = cationController.getAllSeries9000();
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

谁能帮我解决这个问题。

【问题讨论】:

  • 你如何打开对话框[dialogWidget.show()]。如果您使用的是 commandButton,请同时发布该代码。

标签: jsf primefaces dialog datatable


【解决方案1】:

试试这个:

<p:dialog header="RxnNo" widgetVar="dlg3" height="500" width="800">
<h:panelGroup id="global">
     <p:selectOneRadio id="series" value="#{curation.series}">  
          <f:selectItem itemLabel="SGML" itemValue="1" />  
          <f:selectItem itemLabel="9000" itemValue="2" />  
          <f:selectItem itemLabel="8500" itemValue="3" />  
          <p:ajax listener="#{curation.getSeries9000}" update="global" />
      </p:selectOneRadio>
      <p:dataTable id="seriesDataTable" var="series" value="#{homePage.reactionsList}" widgetVar="seriesTable" scrollRows="20" scrollable="true" rowIndexVar="rowIndex">
             <p:column headerText="Id" filterBy="#{rowIndex+1}">                                    
                    <h:outputText value="#{rowIndex+1}" />
          </p:column>
       </p:dataTable> 
</h:panelGroup>
  </p:dialog>

【讨论】:

    猜你喜欢
    • 2017-12-03
    • 1970-01-01
    • 2014-10-14
    • 1970-01-01
    • 2013-05-05
    • 2018-03-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多