extjs actioncolumn renderer阻止处理程序 [英] extjs actioncolumn renderer prevents handler

查看:184
本文介绍了extjs actioncolumn renderer阻止处理程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网格上有一个动作列,代码如下:

I have a actioncolumn on my grid with this code:

    this.columns =
    [
        {
            xtype: 'actioncolumn',
            items: [{
                icon: '../Content/Images/Approve.png',
                handler: function (grid, rowIndex, colIndex, node, e, record, rowNode) {
                    alert('test approve')
                }
            }
          ...rest of the columns

当我点击图标,我得到测试批准消息,所以它按预期工作!

when I click the icon, I get the "test approve" message, so it works as expected!

如果我添加了以下方法的render方法来禁用已批准的行的操作列:

If I add the render method bellow to disable the action column for rows that are already approved:

            renderer: function (value, metadata, record) {
                if (record.get('Approved') = 1) {                        
                    this.items[0].disabled = true
                } else {
                    this.items[0].disabled = false;                       
                }
            }

处理程序停止在启用itens上工作。似乎 renderer 函数阻止调用处理程序。我甚至试图在 renderer 中添加处理程序代码,但也没有成功。

the handler stops working on the enabled itens. It seems like the renderer function is preventing the handler to be called. I even tried to add the handler code inside the renderer, but also no success.

任何想法为什么会发生这种情况?

Any idea why this would happen?

推荐答案

你的条件语句在if语句中,我假设你打算比较不分配。这可能是您的代码破坏

your condition statement in the if statement, i assume you meant to compare not assign. thats probably where your code is breaking

这篇关于extjs actioncolumn renderer阻止处理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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