Oracle Apex - 如何在动态列表中显示图像

时间:2018-01-30 20:02:51

标签: oracle-apex

我为子菜单页面创建了动态列表,现在我想显示每个列表条目的图像

3 个答案:

答案 0 :(得分:0)

一个很好的功能是使用Apex Font Awesome图标。

以下是基于Scott的DEPT表的动态列表查询示例:

select 
  null lvl,
  dname,
  '#' target,
  null is_current,
  case when deptno = 10 then 'fa-thumbs-o-up' 
       when deptno = 20 then 'fa-thumbs-o-down'
  end icon
from dept 
order by deptno

当您将列表添加到页面(作为区域)时,导航到其“属性”并通过将“显示图标”属性设置为“对于所有项目”来修改模板选项。

运行该页面后,您将看到部门10的拇指向上图标和部门20的拇指向下

所有可用图标的列表为here

答案 1 :(得分:0)

答案在创建列表向导的SQL页面的示例1中:

Example 1:
SELECT null, 
       ENAME label, 
       null target, 
       'YES' is_current, 
       '#APP_IMAGES#del.gif' image, -- <-- HERE
       'width="20" height="20"' image_attrib, 
       ENAME image_alt
FROM  emp 
ORDER BY ename

答案 2 :(得分:0)

如下所示的首次使用查询:

select 
  1 level,
  dname label,
  '#' target,
  null is_current,
  'IMAGE'||img_name image
from dept 
order by deptno

,将此查询img_name设置为每张卡的类。之后,在页面加载时使用以下javascript代码:

var spns = document.getElementsByTagName("span");
for (var i = 0; i < spns.length; i++) {                        
 if (spns[i].className.includes('-IMAGE')) { 

   spns[i].style.backgroundImage = "url(#IMAGE_PREFIX#"+spns[i].className.substring(5)+")";

  $('.'+spns[i].className.substring(5)).css("background-size", "cover");
     }    
  }

为此背景图片url应该在ords服务器上存在图片。 祝你好运

相关问题