Skip to main content

Posts

Showing posts from August, 2010

ADF 11g: toggle operators in query component

When you use view criteria to be exposed in an <af:query/> component, it is sometimes weird that ADF allows you to change query operators. In this use case I define a view criteria using a BETWEEN clause on two dates. When you create an <af:query/> component based on this criteria, you will see that it is rendered with operation 'between' as the selected operator. You do however have the possibility to change the operators. This actually makes no sense because you only need between. You can change this behavior on the UI-hints tab of the view criteria editor. When you run the application again, no operators are shown, but you can still insert two dates, still making it clear to the user that the search will be from - to. This is a design-time solution. You can also manipulate this at run-time. Run-time manipulation For this you need to create the view object implementation class. In this class you then create a method that will show or hide the operators. By setting

ADF 11g: Change attribute order in query component

Ever wondered if you can change the order in which the attributes are displayed in an 'af:query' component? It can be done. Here is how. After you have created BC you can drop the named criteria "all queriable attributes" as an 'af:query' component with table. When you run this, you will see the default generated query component. let's assume that the attributes in this component are not in the order that you like. You are in desperate need to show the "job" attribute first. The solution is at view object level. You can change the order of the attributes by invoking the "Set Source Order" button. This button will show you a popup in which you can reorder the attributes. Use the button(s) so the attributes are in the order you want. If you run the page again, the query component shows the "job" attribute first. Too bad that this is a design time solution. There are some pending ER's regarding this subject.

ADF 11g: Using a List in Query component

When you create a default query component you might miss some of the features that ADF offers to you. One of these is the use of lists in the query component. In this post I'll explain to you how to do that. First image here is the way a query component displays when you use all the defaults, and do no tweaking at all. Forget that I already changed some attributes so they are not displayed in the query component. It looks ok, but the user of your application might not be so happy. They have to know the id of all departments. This is fine when you only have a few, but what if you have many ? Let's try to add a list to the query component. We have to start with the creation of the lookup item for department name. This can also be used in the actual table showing the results. First we add an entity usage for departments to the employees view object After this we can add the lookup items. Now create the list of values. The list of values should be based on the departments name att