Hide action column icon with getClass in Extjs 4

extjs, extjs4, javascript

Solution

Here is an example from my project.

Using getClass property of actioncolumn item to achieve this. To hide it return "x-hide-display" class name.

xtype: 'actioncolumn',
  items: [
      {
      getClass: function(v, metadata, r, rowIndex, colIndex, store) {
          // hide this action if row data flag indicates it is not deletable
          if(r.data.deletable == false) {
              return "x-hide-display";
          }
      },
      handler: function(view, rowIndex, colIndex, item, e, record, row) {
          //do something
      },
      icon: 'icons/delete.png'
      }
  ]                             
]

Problem

I have 3 icons in action columns,Edit,Delete,Publish for every rows in grid view. Now what i want is to hide the publish icon and change to unpublish icon on certain conditions.(My records are coming from mysql db).

Original source