Note that there are some explanatory texts on larger screens.

plurals
  1. POvaadin 6.5.7 - How to filter multiple values in a container using
    primarykey
    data
    text
    <p>I'm looking for a solution where I would like to filter my container with multiple values using logical OR.</p> <p>For instance, I would like to filter my value and get the result where value == "A" or "B"</p> <p>This piece of code works when I only have 1 value :</p> <pre><code>private void applyTextFilters(List&lt;String&gt; filters) { unselectAllItems(); IndexedContainer container = (IndexedContainer) valuesTable.getContainerDataSource(); container.removeContainerFilters(Columns.SEARCH.id()); for (String filter : filters) { container.addContainerFilter(Columns.SEARCH.id(), filter, true, false); } clinicalValuesGraph.refreshGraph(container, getLabel("clinicalvalues.graph.caption")); // if it is the case ... //toggleEmptyResultNotification(); handleView(viewMode); } </code></pre> <p>What am I missing? Again, if I have 2 filters ("A","B") in my code, none of the results show but if I pass "A", it works.</p> <p>To follow with my question...</p> <p>Using 6.5.7, I need to filter my container with 2 criterias as in search names like "patrick" OR "john".</p> <p>I've inspected the code and this is where I would need to modify a method (which is protected) :</p> <pre><code>protected boolean passesFilters(Object itemId) { IndexedContainerItem item = new IndexedContainerItem(itemId); if (filters == null) { return true; } final Iterator&lt;Filter&gt; i = filters.iterator(); while (i.hasNext()) { final Filter f = i.next(); if (!f.passesFilter(item)) { return false; } } return true; } </code></pre> <p><strong>TO THIS :</strong></p> <pre><code>protected boolean passesFilters(Object itemId) { IndexedContainerItem item = new IndexedContainerItem(itemId); if (filters == null) { return true; } boolean previouslyPassedFilter = false; boolean PassesFilter = true; final Iterator&lt;Filter&gt; i = filters.iterator(); while (i.hasNext()) { final Filter f = i.next(); if (!f.passesFilter(item) &amp;&amp; !previouslyPassedFilter) { passesFilter = false; } else { previouslyPassedFilter = true; } } return passesFilter ; } </code></pre> <p>How would that be done without having to rewrite all of these classes (IndexedContainer, IndexContainerItem...) ?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload