Friday, April 4, 2014

Hide All Search Operators for ADF View Criteria Item

During this week work, I received interesting question from ADF developer - how to hide all operators for specific ADF View Criteria item. There is an option to go and hide different operators one by one, following API guide for JboCompOper. You could follow this approach, but there is one smarter way - to hide all operators at once. See below - how.

Sample application is available for download - This application implements View Criteria with several items to search for (FirstName, LastName and Salary):

Search operators are configured to be displayed in both Basic and Advanced modes:

This is how it looks on UI - ADF Query with standard list of search operators:

I would like to hide all search operators for FirstName and LastName attributes. This is pretty easy - what we need to do, is to open VO attribute and define CompOper tag. If you want to hide all search operators, simply provide "*" for Name and Oper properties. Set "-2" for ToDo property (this is OPER_TODO_CLEAR, meaning - remove all operators).  Name and Oper are required properties, but we could provide "*" sign, indicating it will be applied for all. Repeat the same for FirstName and LastName attributes:

Search operators will be hidden now for FirstName and LastName items in both modes - Basic:

And Advanced mode:

Sounds pretty easy, isn't it? You should remember a trick with "*" symbol.


Ketan Solanki said...

Thanks a lot!! Very Helpful.

Anonymous said...

I have a use case where when I add an attribute from 'add fields' in the advance mode, the operator for the newly added attribute should be defaulted to 'Contains'. How can I do that?
Thanks in advance :)

Uday said...

Hi Andrejus Baranovskis ,I have been watching your posts since 2 years are amazing !! could you please let me know if there is any way to disable that ADVANCED mode in that searchandselect dailog.

Thanks in Advance !!