Results 1 to 2 of 2

Thread: extjs actioncolumn renderer prevents handler

  1. #1
    Sencha User
    Join Date
    Sep 2012
    Posts
    3
    Vote Rating
    0
      0  

    Default Unanswered: extjs actioncolumn renderer prevents handler

    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!
    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;
    }
    }
    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?

  2. #2
    Ext JS Premium Member
    Join Date
    Feb 2011
    Posts
    28
    Answers
    1
    Vote Rating
    4
      0  

    Default

    Root of the behavior you seeing is the fact that ActionColumn is only one object. It uses the last value that been set when grid rendered, in your case last value of disabled was true and handler is not being called.
    Version 4.1.2 has nice answer in isDisabled configuration parameter:
    Code:
    this.columns =
    [
      {
        xtype: 'actioncolumn',
        items: [{
          icon: '../Content/Images/Approve.png',
          handler: function (grid, rowIndex, colIndex, node, e, record, rowNode) {
            alert('test approve')
          },
         isDisabled: function (view, rowIndex, colIndex, item, record) {
           return record.get('Approved') == 1;
         }
        }]
      }
    ]

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •