clear filter not working

UI Components for JSF
Post Reply
jmm
Posts: 1
Joined: 10 Aug 2017, 18:06

16 Aug 2017, 15:15

Hey everyone. I am kind of lost at this point. I'm trying multiple methods that I found online and none of them seem to work. The issue is that I can filter a paginated datatable just fine, but I cant clear filters. Any idea whats going on? You'll see that I'm trying a few different things in the code, but I'll leave some of it there just so you can see.


Datatable:

Code: Select all

<p:dataTable styleClass="dataTable" id="dataTableRenderer1"
				var="listType" value="#{pc_ListTypeA.speclistpfList}"
				scrollable="true" scrollHeight="600" resizableColumns="true"
				rowKey="#{listType.listvalu}"
				selection="#{tableBean.selectedSpeclistpf}" selectionMode="single" paginator="true" rows="20"  widgetVar="dtr1">				
			
				<p:column headerText="Door Type" footerText="Door Type"
					style="width:100px" rendered="false">
					<h:outputText value="#{listType.listtype}" />
				</p:column>
				<p:column headerText="Category" footerText="Category"
					style="width:100px">
					
					<h:outputText
						value="#{(listType.listgrop eq 'ANS' ? 'Answer' : ' ')}" />
					<h:outputText
						value="#{(listType.listgrop eq 'QUE' ? 'Question' : ' ')}" />
					<h:outputText
						value="#{(listType.listgrop eq 'HED' ? 'Heading' : ' ')}" />
					<h:outputText
						value="#{(listType.listgrop eq 'DSC' ? 'Description' : ' ')}" />
				</p:column>
				<p:column headerText="Question Number" footerText="Question Number"
					style="width:160px" filterBy="#{listType.listgnum}" filterMatchMode="exact">
					<h:outputText value="#{listType.listgnum}" />
				</p:column>
				<p:column headerText="Answer Number" footerText="Answer Number"
					style="width:160px">
					<h:outputText value="#{listType.listgsub}" />
				</p:column>
				<p:column headerText="Value" footerText="Value" style="width:100px"
					rendered="false">
					<h:outputText value="#{listType.listvalu}" />
				</p:column>
				<p:column headerText="Description" footerText="Description"
					style="width:450px">
					<h:outputText value="#{listType.listvdes}" />
				</p:column>
				<p:column headerText="Default" footerText="Default"
					style="width:100px" rendered="false">
					<h:outputText value="#{listType.listvdft}" />
				</p:column>
				<p:column headerText="Display Type" footerText="Display Type"
					style="width:160px" rendered="false">
					<h:outputText value="#{listType.listdspy}" />
				</p:column>
				<p:column headerText="Format" footerText="Format"
					style="width:100px" rendered="false">
					<h:outputText value="#{listType.listfrmt}" />
				</p:column>
			</p:dataTable>
Java:

Code: Select all



 public void updateColumns() {
	        //reset table state
		 System.out.println("Clear Filter0");
	        UIComponent table = FacesContext.getCurrentInstance().getViewRoot().findComponent(":form1:dataTableRenderer1");
	        table.setValueExpression("sortBy", null);
	         
	         System.out.println("Clear Filter1");
	         
	         RequestContext requestContext = RequestContext.getCurrentInstance();
	         requestContext.execute("PF('dtr1').clearFilters()");
	    }

lastresort
Posts: 18
Joined: 07 Nov 2016, 11:14

16 Aug 2017, 16:00

Code: Select all

requestContext.execute("PF('dtr1').clearFilters()");
This should work. Do you refresh your datatable correctly?
PF Elite 8.0.1 + PF Extensions 8.0.2 + MyFaces 2.3-next-M2 @ Quarkus 1.4.2.Final

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 16 guests