SlickGrid设置行不透明度 [英] SlickGrid setting row opacity

查看:157
本文介绍了SlickGrid设置行不透明度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用SlickGrid,并且想知道是否存在一种设置和保持行不透明度或CSS样式的方法.

I am using SlickGrid and am wondering if there is a way to set and keep a rows opacity or css styles in general.

例如,我的行中有一个复选框,并且当用户将复选框设置为选中时,将设置行的不透明度.但是,当用户随后单击该行时,SlickGrid会删除不透明度设置.

For example my rows have a checkbox in them and when the user sets the checkbox to checked then the opacity of the row is set. However when the user then clicks off the row the SlickGrid removes the opacity setting.

如果有人知道该怎么做,一个选择是在SlickGrid完成其重新渲染后设置行的不透明度.这将允许我在整个网格中使用下面的jQuery:

One option if anyone knows how to do it is to set the opacity of the row after SlickGrid has done its re-render. this would allow me to use the jQuery below across the entire grid:

$('img[src="slickgrid/images/tick.png"]').parent().parent().css('opacity','0.4');

推荐答案

以防万一其他人尝试做类似的事情,我通过执行以下操作添加了post渲染事件: 向SlickGrid的API部分添加了一个新方法,然后订阅了该方法并实现了jQuery以更新不透明度.然后,我在SlickGrid的render()方法内触发了该方法.

Just in case anyone else is trying to do something similar, I added a post render event by doing the following: Added a new method to the API section of SlickGrid and then subscribed to that method and implemented the jQuery to updated the opacity. I then triggered the method inside the render() method of SlickGrid.

更清楚一点:

在公共API"部分的slick.grid.js中,我添加了一个新事件:

In the slick.grid.js in the "Public API" section i added a new event:

"onPostRenderJob": new Slick.Event(),

然后我在同一文件中更新了render()函数:

I then updated the render() function in the same file:

function render() {
        // all the standard code here...
        trigger(self.onPostRenderJob);
    }

在配置我已订阅事件的网格的页面中:

In the page that configures the grid i subscribed to the event:

 grid.onPostRenderJob.subscribe(function(e, args) {
                $('img[src="slickgrid/images/tick.png"]').parent().parent().css('opacity', '0.4');
            });

这篇关于SlickGrid设置行不透明度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆