Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsf p:ajax行选择事件在p:commandButton单击时激活_Jsf_Primefaces_Datatable - Fatal编程技术网

Jsf p:ajax行选择事件在p:commandButton单击时激活

Jsf p:ajax行选择事件在p:commandButton单击时激活,jsf,primefaces,datatable,Jsf,Primefaces,Datatable,我的datatable中有选择项和ajax事件: <p:dataTable id="targetTable" value="#{targetController.targetList}" var="target emptyMessage="No result found with given criteria" widgetVar="targetTable" paginator="true" rows="20" selection="#{targetCon

我的datatable中有选择项和ajax事件:

     <p:dataTable id="targetTable" value="#{targetController.targetList}" var="target emptyMessage="No result found with given criteria"
            widgetVar="targetTable" paginator="true" rows="20" selection="#{targetController.editTarget}" selectionMode="single" paginatorPosition="top"
           rowsPerPageTemplate="5,20,50" lazy="true"
            >
            <p:ajax event="rowSelect" listener="#{targetController.editTarget}" />

            ... columns ..
      </p:dataTable>
我添加了一列按钮,如下所示:

      <p:column width="100"><f:facet name="header">#{i.m['Changes history']}</f:facet>
                <p:commandButton id="showChangesHistory" value="#{i.m['Show Changes']}"  onclick="return false;" type="button" />
      </p:column>
我的问题是targetController.editTarget在单击按钮时激活


PrimeFooS版本:3.3.1

,您是否考虑在列上使用SaleStyMod属性,而不是整张表?如下所示:在列上指定selectionMode就足够了,或者我也需要指定selection?选择可以保留在表上,就像本教程中所做的那样:不幸的是,当前的行为是单击一行即可启动编辑页面。添加selectionMode=single on column会将其转换为单选按钮列,并删除当前的点击事件,因此这不是一个可接受的解决方案。请查看此处: