Ext JS:获取特定行的操作列 [英] Ext JS: Getting a specific row's action column

查看:311
本文介绍了Ext JS:获取特定行的操作列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网格,其中包含每行的动作列。此操作列是一个编辑图标,当用户单击编辑图标时,我正在启动一些Websocket事件,最终会流淌到当前连接到该应用程序的其他用户。我想要做的是将其编辑图标灰色显示给其他用户。所有这些代码正在运行,除了:我不知道我如何访问实际的行的动作列对象。



我可以使用网格的视图访问它,并抓住单个节点,然后设置某种CSS,如下所示:

  var rowHtml = this.getView()。getNode(index ); 
if(rowHtml){
var rowDom = Ext.fly(rowHtml);
if(rowDom){
rowDom.down('。someclass')。removeCls('enabled')。addCls('disabled');
}
}

这应该可以工作,但我也想更新工具提示,一般来说,我只是希望能够访问这个元素。



所以,我想主要的问题是,当这个动作列被创建的时候创建为按钮或其他一些Ext JS元素? API指出,子组件的defaultType 是一个网格列,但我想这不是这个动作列真的吗?另外,有没有一个简单的方法来访问这个项目作为Ext JS类?



编辑:我已经看到以下线程,但是他们处理更多的渲染行...我的行已经呈现:



隐藏特定行的操作列中的图标



如何禁用操作列项单行

解决方案

我决定不删除和添加一个类。我目前正在做类似上述方法,但是像这样:

  var rowHtml = this.getView()。 getNode(索引); 
if(rowHtml){
var rowDom = Ext.fly(rowHtml);
if(rowDom){
rowDom.down('。someclass')。hide(); //或显示,基于一些其他逻辑
}
}

我去隐藏/显示,因为如果我只是编辑CSS,仍然可以点击动作图标。通过隐藏/显示,我们摆脱了这种可能性。这不是理想的,但它可以作为一个快速的黑客。


I have a grid that contains an action column for each row. This action column is an edit icon, and when a user clicks the edit icon, I'm kicking off some websocket events, which will eventually trickle down to other users currently connected to the app. What I want to do is grey out this edit icon for the other users. All of that code is working except: I have no idea how I can access the actual row's action column object.

I can access it by using the grid's view and grabbing that individual node, then setting some sort of CSS, something like this:

var rowHtml = this.getView().getNode(index);
if (rowHtml) {
  var rowDom = Ext.fly(rowHtml);
  if (rowDom) {
    rowDom.down('.someclass').removeCls('enabled').addCls('disabled');
  }
}

That should work, but I also want to update the tooltip, and in general, I just want to be able to access this element.

So, I guess the main question is, when this action column gets created, is it created as a button or some other Ext JS element? The API states that the defaultType for child components is a gridcolumn, but I imagine that's not what this action column really is? Also, is there an easy way of accessing this item as an Ext JS class?

Edit: And I have seen the following threads, but they deal more with rendering the rows... my rows are already rendered:

Hide Icon in Action Column for Particular Row

How to Disable Action Column Item for a Single Row

解决方案

I've decided against removing and adding a class. I'm currently doing it a similar way as described above, but like this:

var rowHtml = this.getView().getNode(index);
if (rowHtml) {
  var rowDom = Ext.fly(rowHtml);
  if (rowDom) {
    rowDom.down('.someclass').hide();  // or show, based on some other logic
  }
}

I went with hiding/showing because if I just edit the CSS, the action icon can still be clicked. By hiding/showing, we get rid of that possibility. It's not ideal, but it works as a quick hack.

这篇关于Ext JS:获取特定行的操作列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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