dojox.grid.DataGrid - onStyleRow需要更新? (dojo 1.2.0) [英] dojox.grid.DataGrid - onStyleRow needs update? (dojo 1.2.0)

查看:231
本文介绍了dojox.grid.DataGrid - onStyleRow需要更新? (dojo 1.2.0)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在jsp中使用了一个dojox.grid.DataGrid。

we are using a dojox.grid.DataGrid in a jsp.

<script type="dojo/method" event="onStyleRow" args="inRow">
    var grid = dijit.byId("someID");
    var item = grid.getItem(inRow.index);
    if(item != undefined) {
        if(item.someAttribute == "1") {
            inRow.customClasses = "dojoxGridMYRow";
        } else {
            inRow.customClasses = "dojoxGridRow";
        }
    }     
    if(aBoolean) {
        inRow.customStyles = "backgrund-color: #FFCC00";
    }
    //dojox.grid.DataGrid.prototype.onStyleRow.apply(this, arguments);
    //grid.focus.styleRow(inRow);
    //grid.edit.styleRow(inRow);        
</script>

第一条注释行是在单击行时获取正常的行为。
但是它不会更改任何东西,直到grid.update()被调用,这不是很好,重新加载很多行。它像一个闪烁的奇怪的是,如果鼠标移过更改的行,它会更改背景颜色(如果没有更新被调用)。所以必须有可能没有更新。调用updateRow或renderRow这样的东西会导致无限循环。

The first commented line is to get normal behaviour when clicking a row. But it wont change anything until a grid.update() is called, which is not nice, reloading many rows. Its like a flickering. The strange is, if the mouse goes over the changed rows it changes the background color(if no update was called). So it must be possible without a update. Calling updateRow or renderRow oder something like this will cause a infinite loop.

任何人都可以帮我吗? :/

Can anyone help me? :/

编辑:
我也试图复制onStyleRow的行为(因为所选行被直接标记为红色),但它只是设置customClasses并调用this.focus.styleRow(inRow)和this.edit.styleRow(inRow)。将这些行添加到我的函数也没有效果。

I also tried to copy the behaviour of onStyleRow(cause the selected row is directly marked red), but it makes nothing else than setting customClasses and call this.focus.styleRow(inRow) and this.edit.styleRow(inRow). adding these lines to my function does also take no effect.

推荐答案

inRow.customStyles = "backgrund-color: #FFCC00";

您似乎拼写了背景错误。

这篇关于dojox.grid.DataGrid - onStyleRow需要更新? (dojo 1.2.0)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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