1
votes

we are developing a web application using

  • Oracle ADF
  • jDeveloper

Our Requirement: we have a table called Departments with two columns "deptId and Employees". We have created Entity and view objects for Departments table. We are using data control of view object to create a table in jsf page. Our desired table is as below. We drag and drop first column. And we need to create another column that should contain green image if employees in the department is less than 100(for ex) otherwise red image. Our main requirement is we have show image depending on some condition.

enter image description here

Thanks in advance.

2

2 Answers

1
votes

Or in a single line with conditional EL:

<af:image source=
 "#{row.bindings.EmployeeCount.inputValue ge 100 ? '/red.png' : '/green.png'}"/>
0
votes

Our main requirement is we have show image depending on some condition.

My assumption is that you already have an attribute in your View object which reflects the data you depend on (the number of employees as EmployeeCount, in this case). Then, you can simply use the rendered attribute together with an EL expression to display different images in your table:

...
<af:column headerText="Icon" id="c1">
    <af:image source="#{resource['images:green.png']}" id="i1" 
              rendered="#{row.bindings.EmployeeCount.inputValue lt 100}"/>
    <af:image source="#{resource['images:red.png']}" id="i2" 
              rendered="#{row.bindings.EmployeeCount.inputValue ge 100}"/>
</af:column>
...