我想在oncomplete上的primefaces列过滤器上触发keyup,以便datatable可以重新过滤。我试过以下。但它似乎没有效果?
oncomplete="$('#form1\\:mm1001_datatable_listOfMoneyMarket\\:mm1001_column_tradeid').trigger('filter')"
oncomplete="$('#form1\\:mm1001_datatable_listOfMoneyMarket\\:mm1001_column_tradeid').trigger('keyup')"
<h:form id="form1" enctype="multipart/form-data" prependId="false">
<p:dataTable
styleClass="dataTable" id="mm1001_datatable_listOfMoneyMarket"
value="#{pc_Mm1001.w_mmdeal.theListingOfMoneyMarket}"
var="varlistOfMoneyMarket" rows="50" paginator="true"
paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks}
{NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="10, 25, 50, 75,100,200"
resizableColumns="true" paginatorPosition="bottom"
filteredValue="#{pc_Mm1001.w_mmdeal.listOfFilteredMoneyMarket}"
widgetVar="listOfMoneyMarket">
<p:ajax event="filter" listener="#{pc_Mm1001.filterListener}"></p:ajax>
<p:column id="mm1001_column_tradeid" width="90"
sortBy="#{varlistOfMoneyMarket.trade_id}"
filterBy="#{varlistOfMoneyMarket.trade_id}"
filterMatchMode="contains" resizable="true"
rendered="#{pc_Mm1001.showColumn_trade_id}"
filterStyle="width:80px"
style="text-align: left; font-weight : 400"
headerText="#{msg.mm1001_gridheader_trade_id}"
filterValue="#{pc_Mm1001.w_mmdeal.fv_trade_id}">
<p:commandLink ajax="false" styleClass="commandLink"
id="mm1001_commandlink_tradeid"
action="#{pc_Mm1001.doMm1001_commandlink_tradeidAction}">
<h:outputText id="mm1001_gridoutput_tradeid"
styleClass="outputGridText_px"
value="#{varlistOfMoneyMarket.trade_id}"></h:outputText>
<f:param name="clicked_transaction_id"
value="#{varlistOfMoneyMarket.transaction_id}"></f:param>
</p:commandLink>
</p:column>
</h:form>
答案 0 :(得分:0)
你的ID似乎是错误的,因为pf过滤器后缀为:filter
,(要查找过滤器input
id do(在chrome中):右键单击过滤器输入 - &gt;检查元素< / p>
看一下展示:DataTable - Filtering
过滤展示中的模型列,以下代码将起作用:
设置一些值(例如7)
$('#form\\:dataTable\\:modelColumn\\:filter').val('7');
触发过滤器输入上的keyup事件
$('#form\\:dataTable\\:modelColumn\\:filter').keyup();