New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DataTable: Global FilterFunction Broken #6953
Comments
😢 |
We should add a integration-test for this ... whatever the expected correct behaviour is. |
I am waiting to hear back on this review then will write one. |
Integration Tests... Global Filter: https://github.com/primefaces-extensions/primefaces-integration-tests/commit/64d6e5c246ab3735889142a77060e8d3ec6f4451 Global Filter Function: https://github.com/primefaces-extensions/primefaces-integration-tests/commit/18d79fca8a43d45aee64bdc0547c90ab4cec3dee |
@melloware @sqores please dont merge such PRs without review before. |
this just leads to dead and bad code now. |
Thomas this use case was wholesale broken and was missed in the refactor. Feel free to review but I believe the fixes are the correct one and I have integration tests to verify. |
thats ok but we have deadcode now as FunctionFilterConstraint is actually unused |
Are you sure? FunctionFilterConstraint is still used when a column has a filter like... <p:column filterFunction=""... Right? |
not sure but the codepath in FilterMeta ln122 is now dead |
Ok let me add some more tests and verify and then I can remove the dead code. |
@tandraschko When you say ln122 I think you mean this line: FilterConstraint constraint = globalFilterFunction == null
? new GlobalFilterConstraint()
: new FunctionFilterConstraint(globalFilterFunction); If so I have Integration tests that prove both paths are followed. GlobalFilterConstraint is used when you have a generic GloblalFilter like in my DataTable001Test. <p:inputText id="globalFilter" onchange="PF('wgtTable').filter()" placeholder="Enter keyword"/> FunctionFilterConstraint is used when you have either a custom GloblalFilter or a Column FilterFunction like in my DataTable019Test. <p:dataTable id="datatable" globalFilterFunction="#{dataTable019.globalFilterFunction}">
<p:column field="type" filterFunction="#{dataTable019.columnFilterFunction}"/> So I am still not sure there is any dead code and this wasn't the correct change to make. If you have more insight I am happy to write more Integration Tests |
The method of ln122 creates the global FilterMeta and reuses globalFilterFunction. |
I see what you mean now. Removed this code and all Integration Tests are still passing. |
Added new Integration test for column filter function as well: |
Describe the defect
Working on a showcase example to put back the old GlobalFilterFunction and the functionality has changed.
its expecting the
value
to be the Customer POJO and right now it is just passing it each individual column value as a String which causesjava.lang.ClassCastException: java.lang.String cannot be cast to org.primefaces.showcase.domain.Customer
.The old code was passing the table.RowData();
But the new code is passing each individual column.
The text was updated successfully, but these errors were encountered: