Ext JS: Getting a specific row's action column

旧时模样 提交于 2019-12-13 05:38:05

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/22178998/ext-js-getting-a-specific-rows-action-column

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!