Hybrid View

  1. #1
    Sencha User
    Join Date
    Jun 2012
    Posts
    16
    Vote Rating
    0
    larini is on a distinguished road

      0  

    Default getClass for actionColumn only in a few rows

    getClass for actionColumn only in a few rows


    Hi, I'm using the code below, to set the css class for an action column.
    But even if the result is null, some elements are inserted by extjs.


    Code:
    getClass: function(v, meta, data) {        
          if (data.myDate < new Date())
                return null;
          else
                return 'insert';
      }
    html:

    Code:
    <img alt="" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" 
    class="x-action-col-icon x-action-col-1   null">

  2. #2
    Sencha - Community Support Team sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,333
    Vote Rating
    85
    sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough

      0  

    Default


    Hi larini,

    It's work for me see the sample example-
    Code:
    Ext.create('Ext.data.Store', {
    storeId:'employeeStore',
    fields:['firstname', 'lastname', 'seniority', 'dep', 'hired'],
    data:[
    {firstname:"Michael", lastname:"Scott"},
    {firstname:"Dwight", lastname:"Schrute"},
    {firstname:"Jim", lastname:"Halpert"},
    {firstname:"Kevin", lastname:"Malone"},
    {firstname:"Angela", lastname:"Martin"}
    ]
    });
    
    Ext.create('Ext.grid.Panel', {
    title: 'Action Column Demo',
    store: Ext.data.StoreManager.lookup('employeeStore'),
    columns: [
    {text: 'First Name',  dataIndex:'firstname'},
    {text: 'Last Name',  dataIndex:'lastname'},
    {
    xtype:'actioncolumn',
    width:50,
    
    items: [{
    icon: 'extjs/examples/shared/icons/fam/cog_edit.png',  // Use a URL in the icon config
    tooltip: 'Edit',
    getClass:function(){
    return 'color';
    },
    handler: function(grid, rowIndex, colIndex) {
    var rec = grid.getStore().getAt(rowIndex);
    alert("Edit " + rec.get('firstname'));
    }
    },{
    icon: 'extjs/examples/restful/images/delete.png',
    tooltip: 'Delete',
    handler: function(grid, rowIndex, colIndex) {
    var rec = grid.getStore().getAt(rowIndex);
    alert("Terminate " + rec.get('firstname'));
    }
    }]
    }
    ],
    width: 250,
    renderTo: Ext.getBody()
    });‚Äč
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

  3. #3
    Sencha User
    Join Date
    Jun 2012
    Posts
    16
    Vote Rating
    0
    larini is on a distinguished road

      0  

    Default


    In your case, you are always returning "color" class for this column. In my case, I'm doing something like:

    Code:
    getClass: function () {
        if (....)
            return 'color';
        else
            return null;
    
    
    },

Thread Participants: 1

Tags for this Thread