简体   繁体   English

在ADF中动态更改图像

[英]Change image dynamically in ADF

I have created one demo application containing a single table with 5 columns. 我创建了一个演示应用程序,其中包含一个包含5列的表。 First row contains employee id along with an image. 第一行包含员工ID和图片。 What i want is whenever i click on the table row the image corresponds to that row gets change to another image. 我想要的是每当我单击表格行时,对应于该行的图像都会更改为另一张图像。 could you please tell me how? 你能告诉我如何吗? I am using Jdeveloper12 version 我正在使用Jdeveloper12版本

style class for image1 image1的样式类

af|image.customImage
{
       background: url("../../Images/Search.png");
       background-repeat: no-repeat;
       width: 20pt;
        height: 20pt;
}

Style class for second image 第二张图片的样式类

af|image.customImage
{
       background: url("../../Images/icTickActive.png");
       background-repeat: no-repeat;
       width: 20pt;
        height: 20pt;
}

I have created a bean class and bind the StyleClass property of image into the style variable declared on the bean class. 我创建了一个bean类,并将图像的StyleClass属性绑定到在bean类上声明的style变量中。

Bean Class 豆类

public class SelectionBean {
public SelectionBean() {
}
private String imageStyle="customImageChecked";

public void setImageStyle(String imageStyle) {
    this.imageStyle = imageStyle;
}

public String getImageStyle() {
    return imageStyle;
}

public void changeImage(SelectionEvent selectionEvent) { //table selectionlistener event
   if(imageStyle.equals("customImage")) {
       setImageStyle("customImageChecked");
   }else {
    setImageStyle("customImage");   
   }
}}

could anyone please help me to correct my mistake??? 谁能帮我纠正我的错误???

您可能需要在表和图像之间添加partialTrigger连接,以便在选择行时图像将刷新。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM