View Full Version : How to add or not add item to Grid action column

3 Aug 2013, 6:53 AM

I have a problem about grid action column.
I manage to have view or edit icon in my action depending on field value in record using getClass config of columnaction. It's work fine.

But for the first time, I need to have or not have delete icon on some row depending on field value.
I'm trying to use getClass but it (I?) failed.

my code:

xtype: 'actioncolumn',
items: [{
icon: 'resources/images/application_form_edit.png',
iconCls: 'editIcon '+this.id,
tooltip: 'Editer'
}, {
getClass: function(v, meta, record)
var idcat = record.get('IDCAT'),
reg = /.*_RC$/;

if(idcat.search(reg) != -1)
return 'deleteIcon '+this.id;
return false;
align: 'center',
width: 120,
flex: 1

My problem is simple, if I have to add delete icon, it's work if not, I got an "ghost" icon because I return false (I tried with null and '', same result).
I guess getClass can't help me, because it's add an item and when I read source code, there is no test on the return and it's explain why I get a ghost icon.

My question is, may I need to override this code to add test on getClass return value or is there a better way to do this?

Maybe a missing feature?

thanks to your help and sorry for my bad english.

5 Aug 2013, 12:20 AM

I think getClass is the best solution for your problem.
I try to create the same column with same method and i have no problem with ghost icon when getClass return false.
What's your browser? I try this on firefox and chrome.
Maybe, you can work on CSS to had a specific class like 'icon-hidden' with 'visibility: hidden !important;' to hide your gosth icon.

5 Aug 2013, 4:16 AM
Thanks Alexandre for your reply.

You right I can play with CSS to be sure to hide icon and don't have hand icon during mouse hover event. But to me I prefered find a way to don't create what I don't want. I guess I will override render function if I'm not find another way.