JQuery动态选择器改变背景颜色不起作用

时间:2015-09-15 07:15:31

标签: jquery css angularjs selector angular-grid

我有一个if (params.value) { $("div[row='3']").css('background-color','gray'); } 的{​​{3}}行,我希望它的背景颜色发生变化,它应该在其AngularGrid属性的回调函数的点击事件中更改:

import java.awt.AlphaComposite;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Iterator;

import javax.imageio.IIOImage;
import javax.imageio.ImageIO;
import javax.imageio.ImageWriteParam;
import javax.imageio.ImageWriter;
import javax.imageio.stream.FileImageOutputStream;


public class Example {

    public static void main(String[] args) throws IOException {
        InputStream is = Example.class.getResourceAsStream("Lenna.png");
        BufferedImage bi = ImageIO.read(is);

        rescale(bi);

        for(int i=1;i<10;i++){
            compress(i,bi);
        }

    }

    private static void rescale(BufferedImage bi) throws IOException {
        int originalWidth = bi.getWidth();
        int originalHeight = bi.getHeight();
        int type = bi.getType() == 0? BufferedImage.TYPE_INT_ARGB : bi.getType();

        //rescale 50%
        BufferedImage resizedImage = new BufferedImage(originalWidth/2, originalHeight/2, type);
        Graphics2D g = resizedImage.createGraphics();
        g.drawImage(bi, 0, 0, originalWidth/2, originalHeight/2, null);
        g.dispose();
        g.setComposite(AlphaComposite.Src);
        g.setRenderingHint(RenderingHints.KEY_INTERPOLATION,RenderingHints.VALUE_INTERPOLATION_BILINEAR);
        g.setRenderingHint(RenderingHints.KEY_RENDERING,RenderingHints.VALUE_RENDER_QUALITY);
        g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
        ImageIO.write(resizedImage, "jpg", new File("Lenna50.jpg"));
    }

    private static void compress(int compression, BufferedImage bi)
            throws FileNotFoundException, IOException {
        Iterator<ImageWriter> i = ImageIO.getImageWritersByFormatName("jpeg");
        ImageWriter jpegWriter = i.next();

        // Set the compression quality
        ImageWriteParam param = jpegWriter.getDefaultWriteParam();
        param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
        param.setCompressionQuality(0.1f * compression);

        // Write the image to a file
        FileImageOutputStream out = new FileImageOutputStream(new File("Lenna"+compression+".jpg"));
        jpegWriter.setOutput(out);
        jpegWriter.write(null, new IIOImage(bi, null, null), param);
        jpegWriter.dispose();
        out.close();
    }

}

代码对于动态rowIndex不起作用,但是如果我在这个回调事件上对这样的索引进行硬编码就可以正常工作:

{{1}}

请告诉我如何动态更改此函数调用的每一行的css样式?感谢。

0 个答案:

没有答案